Contest Duration: ~ (local time) (120 minutes) Back to Home

Submission #210361

Source Code Expand

Copy
```#include <bits/stdc++.h>
using namespace std;
#define all(c) (c).begin(),(c).end()
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define rrep(i,n) for(int i=(int)(n)-1; i>=0; i--)
#define REP(i,m,n) for(int i=(int)(m); i<(int)(n); i++)
#define iter(c) __typeof((c).begin())
#define tr(it,c) for(iter(c) it=(c).begin(); it!=(c).end(); it++)
#define pb(a) push_back(a)
#define pr(a) cout << (a) << endl
#define PR(a,b) cout << (a) << " " << (b) << endl
#define F first
#define S second
typedef long long ll;
typedef pair<int,int> P;
const int MAX=1000000001;
const ll MAXL=1000000000000000001LL;
const ll mod=1000000007;
int dx[4]={-1,0,1,0},dy[4]={0,-1,0,1};

const int MAX_V=50;

struct edge{
int to,cap,rev;
};
vector<edge> G[MAX_V];
bool used[MAX_V];

void add_edge(int from,int to, int cap) {
G[from].push_back((edge){to,cap,G[to].size()});
G[to].push_back((edge){from,0,G[from].size()-1});
}

int dfs(int v,int t,int f) {
if(v==t) return f;
used[v]=true;
rep(i,G[v].size()) {
edge &e=G[v][i];
if(!used[e.to] && e.cap>0) {
int d=dfs(e.to,t,min(f,e.cap));
if(d>0) {
e.cap-=d;
G[e.to][e.rev].cap+=d;
return d;
}
}
}
return 0;
}

int max_flow(int s,int t) {
int flow=0;
for(;;) {
memset(used,0,sizeof(used));
int f=dfs(s,t,MAX);
if(f==0) return flow;
flow+=f;
}
}

int main() {
int n,m;
cin >> n >> m;
vector<string> a(n);
rep(i,n) {
cin >> a[i];
}
rep(i,n-1) {
REP(j,i+1,n) {
bool ck=true;
rep(k,m) {
if(a[i][k]!='*' && a[j][k]!='*') {
if(a[i][k]!=a[j][k]) ck=false;
}
}
if(ck) {
}
}
}
int cnt=0;
rep(i,n) {
if(max_flow(i,20)>0) cnt++;
}
pr(cnt);
return 0;
}
```

#### Submission Info

Submission Time 2014-08-09 21:56:22+0900 C - 天下一文字列集合 s1200008 C++ (G++ 4.6.4) 20 1858 Byte WA 227 ms 2396 KB

#### Judge Result

Set Name Score / Max Score Test Cases
small 20 / 20 00_small100.txt, 00_small101.txt, 00_small102.txt, 00_small103.txt, 00_small104.txt, 00_small105.txt, 00_small106.txt, 00_small107.txt, 00_small108.txt, 00_small109.txt, 00_small110.txt, 00_small111.txt, 00_small112.txt, 00_small113.txt, 00_small114.txt, 00_small115.txt, 00_small116.txt, 00_small117.txt
medium 0 / 30 00_small100.txt, 00_small101.txt, 00_small102.txt, 00_small103.txt, 00_small104.txt, 00_small105.txt, 00_small106.txt, 00_small107.txt, 00_small108.txt, 00_small109.txt, 00_small110.txt, 00_small111.txt, 00_small112.txt, 00_small113.txt, 00_small114.txt, 00_small115.txt, 00_small116.txt, 00_small117.txt, 01_medium100.txt, 01_medium101.txt, 01_medium102.txt, 01_medium103.txt, 01_medium104.txt, 01_medium105.txt, 01_medium106.txt, 01_medium107.txt, 01_medium108.txt, 01_medium109.txt, 01_medium110.txt, 01_medium111.txt, 01_medium112.txt, 01_medium113.txt, 01_medium114.txt, 01_medium115.txt, 01_medium116.txt, 01_medium117.txt, 01_medium118.txt, 01_medium119.txt, 01_medium120.txt, 01_medium121.txt, 01_medium122.txt, 01_medium123.txt, 01_medium124.txt, 01_medium125.txt, 01_medium126.txt, 01_sample0.txt
All 0 / 50 00_small100.txt, 00_small101.txt, 00_small102.txt, 00_small103.txt, 00_small104.txt, 00_small105.txt, 00_small106.txt, 00_small107.txt, 00_small108.txt, 00_small109.txt, 00_small110.txt, 00_small111.txt, 00_small112.txt, 00_small113.txt, 00_small114.txt, 00_small115.txt, 00_small116.txt, 00_small117.txt, 01_medium100.txt, 01_medium101.txt, 01_medium102.txt, 01_medium103.txt, 01_medium104.txt, 01_medium105.txt, 01_medium106.txt, 01_medium107.txt, 01_medium108.txt, 01_medium109.txt, 01_medium110.txt, 01_medium111.txt, 01_medium112.txt, 01_medium113.txt, 01_medium114.txt, 01_medium115.txt, 01_medium116.txt, 01_medium117.txt, 01_medium118.txt, 01_medium119.txt, 01_medium120.txt, 01_medium121.txt, 01_medium122.txt, 01_medium123.txt, 01_medium124.txt, 01_medium125.txt, 01_medium126.txt, 01_sample0.txt, 02_large100.txt, 02_large101.txt, 02_large102.txt, 02_large103.txt, 02_large104.txt, 02_large105.txt, 02_large106.txt, 02_large107.txt, 02_large108.txt, 02_large109.txt, 02_large110.txt, 02_large111.txt, 02_large112.txt, 02_large113.txt, 02_large114.txt, 02_large115.txt, 02_large116.txt, 02_large117.txt, 02_large118.txt, 02_large119.txt, 02_large120.txt, 02_large121.txt, 02_large122.txt, 02_large123.txt, 02_large124.txt, 02_large125.txt, 02_large126.txt, 02_large127.txt, 02_large128.txt, 02_large129.txt, 02_large130.txt
Case Name Status Exec Time Memory
00_small100.txt 21 ms 804 KB
00_small101.txt 20 ms 800 KB
00_small102.txt 21 ms 808 KB
00_small103.txt 20 ms 800 KB
00_small104.txt 21 ms 796 KB
00_small105.txt 20 ms 932 KB
00_small106.txt 21 ms 932 KB
00_small107.txt 21 ms 676 KB
00_small108.txt 21 ms 928 KB
00_small109.txt 21 ms 808 KB
00_small110.txt 22 ms 804 KB
00_small111.txt 21 ms 928 KB
00_small112.txt 21 ms 932 KB
00_small113.txt 21 ms 796 KB
00_small114.txt 21 ms 800 KB
00_small115.txt 20 ms 928 KB
00_small116.txt 21 ms 804 KB
00_small117.txt 21 ms 804 KB
01_medium100.txt 21 ms 932 KB
01_medium101.txt 21 ms 928 KB
01_medium102.txt 21 ms 932 KB
01_medium103.txt 22 ms 792 KB
01_medium104.txt 20 ms 924 KB
01_medium105.txt 21 ms 928 KB
01_medium106.txt 22 ms 788 KB
01_medium107.txt 21 ms 924 KB
01_medium108.txt 21 ms 800 KB
01_medium109.txt 25 ms 928 KB
01_medium110.txt 21 ms 808 KB
01_medium111.txt 20 ms 796 KB
01_medium112.txt 26 ms 804 KB
01_medium113.txt 21 ms 732 KB
01_medium114.txt 21 ms 920 KB
01_medium115.txt 20 ms 800 KB
01_medium116.txt 21 ms 920 KB
01_medium117.txt 20 ms 800 KB
01_medium118.txt 23 ms 840 KB
01_medium119.txt 21 ms 760 KB
01_medium120.txt 20 ms 928 KB
01_medium121.txt 23 ms 772 KB
01_medium122.txt 22 ms 932 KB
01_medium123.txt 22 ms 932 KB
01_medium124.txt 21 ms 812 KB
01_medium125.txt 21 ms 928 KB
01_medium126.txt 20 ms 796 KB
01_sample0.txt 20 ms 796 KB
02_large100.txt 108 ms 2336 KB
02_large101.txt 128 ms 2332 KB
02_large102.txt 112 ms 2396 KB
02_large103.txt 110 ms 2332 KB
02_large104.txt 112 ms 2344 KB
02_large105.txt 111 ms 2340 KB
02_large106.txt 40 ms 1064 KB
02_large107.txt 25 ms 868 KB
02_large108.txt 23 ms 760 KB
02_large109.txt 23 ms 760 KB
02_large110.txt 22 ms 808 KB
02_large111.txt 181 ms 2344 KB
02_large112.txt 145 ms 2396 KB
02_large113.txt 31 ms 932 KB
02_large114.txt 169 ms 2348 KB
02_large115.txt 109 ms 2344 KB
02_large116.txt 170 ms 2336 KB
02_large117.txt 26 ms 928 KB
02_large118.txt 193 ms 2340 KB
02_large119.txt 212 ms 2332 KB
02_large120.txt 223 ms 2340 KB
02_large121.txt 227 ms 2340 KB
02_large122.txt 220 ms 2396 KB
02_large123.txt 203 ms 2340 KB
02_large124.txt 180 ms 2344 KB
02_large125.txt 156 ms 2336 KB
02_large126.txt 132 ms 2348 KB
02_large127.txt 182 ms 2364 KB
02_large128.txt 123 ms 2332 KB
02_large129.txt 214 ms 2340 KB
02_large130.txt 121 ms 2336 KB