Submission #5111

# Submission time Handle Problem Language Result Execution time Memory
5111 2014-02-08T18:14:39 Z cki86201 지도 색칠하기 (GA3_map) C++
120 / 120
824 ms 1088 KB
typedef long long ll;
 
int E[22][22], L[22], C[22], N;
 
bool dfs(int bit,int x,int now)
{
  	bool ret = true;
	C[x] = now;
	for(int i=0;i<L[x];i++){
		int t = E[x][i];
		if(bit&1<<t){
			if(C[t] == now)return false;
			if(C[t] == -1)ret &= dfs(bit,t,now^1);
		}
	}
	return ret;
}
 
int f(int x)
{
	int ret = 1, i;
	for(i=0;i<N;i++)C[i] = -1;
	for(i=0;i<N;i++){
		if((1<<i&x) && C[i]==-1){
			if(!dfs(x,i,0))return 0;
			ret <<= 1;
		}
	}
	return ret;
}
 
ll NumberOfMaps (int N, int M, int *A, int *B){
	::N = N;
	int i;
	for(i=0;i<M;i++){
		--A[i], --B[i];
		E[A[i]][L[A[i]]++] = B[i];
		E[B[i]][L[B[i]]++] = A[i];
	}
	ll ret = 0;
	for(i=0;i<1<<N-1;i++)ret += f(i) * f(((1<<N)-1)^i);
	return ret<<1;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 1088 KB Output is correct
2 Correct 0 ms 1088 KB Output is correct
3 Correct 0 ms 1088 KB Output is correct
4 Correct 0 ms 1088 KB Output is correct
5 Correct 0 ms 1088 KB Output is correct
6 Correct 0 ms 1088 KB Output is correct
7 Correct 0 ms 1088 KB Output is correct
8 Correct 0 ms 1088 KB Output is correct
9 Correct 0 ms 1088 KB Output is correct
10 Correct 0 ms 1088 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 1088 KB Output is correct
2 Correct 0 ms 1088 KB Output is correct
3 Correct 0 ms 1088 KB Output is correct
4 Correct 0 ms 1088 KB Output is correct
5 Correct 0 ms 1088 KB Output is correct
6 Correct 0 ms 1088 KB Output is correct
7 Correct 0 ms 1088 KB Output is correct
8 Correct 0 ms 1088 KB Output is correct
9 Correct 0 ms 1088 KB Output is correct
10 Correct 0 ms 1088 KB Output is correct
11 Correct 0 ms 1088 KB Output is correct
12 Correct 0 ms 1088 KB Output is correct
13 Correct 0 ms 1088 KB Output is correct
14 Correct 0 ms 1088 KB Output is correct
15 Correct 0 ms 1088 KB Output is correct
16 Correct 0 ms 1088 KB Output is correct
17 Correct 0 ms 1088 KB Output is correct
18 Correct 0 ms 1088 KB Output is correct
19 Correct 0 ms 1088 KB Output is correct
20 Correct 0 ms 1088 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 1088 KB Output is correct
2 Correct 0 ms 1088 KB Output is correct
3 Correct 0 ms 1088 KB Output is correct
4 Correct 0 ms 1088 KB Output is correct
5 Correct 0 ms 1088 KB Output is correct
6 Correct 0 ms 1088 KB Output is correct
7 Correct 0 ms 1088 KB Output is correct
8 Correct 0 ms 1088 KB Output is correct
9 Correct 0 ms 1088 KB Output is correct
10 Correct 4 ms 1088 KB Output is correct
11 Correct 0 ms 1088 KB Output is correct
12 Correct 0 ms 1088 KB Output is correct
13 Correct 4 ms 1088 KB Output is correct
14 Correct 4 ms 1088 KB Output is correct
15 Correct 4 ms 1088 KB Output is correct
16 Correct 4 ms 1088 KB Output is correct
17 Correct 4 ms 1088 KB Output is correct
18 Correct 4 ms 1088 KB Output is correct
19 Correct 0 ms 1088 KB Output is correct
20 Correct 0 ms 1088 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 8 ms 1088 KB Output is correct
2 Correct 16 ms 1088 KB Output is correct
3 Correct 8 ms 1088 KB Output is correct
4 Correct 8 ms 1088 KB Output is correct
5 Correct 20 ms 1088 KB Output is correct
6 Correct 16 ms 1088 KB Output is correct
7 Correct 32 ms 1088 KB Output is correct
8 Correct 20 ms 1088 KB Output is correct
9 Correct 36 ms 1088 KB Output is correct
10 Correct 36 ms 1088 KB Output is correct
11 Correct 20 ms 1088 KB Output is correct
12 Correct 24 ms 1088 KB Output is correct
13 Correct 52 ms 1088 KB Output is correct
14 Correct 52 ms 1088 KB Output is correct
15 Correct 24 ms 1088 KB Output is correct
16 Correct 80 ms 1088 KB Output is correct
17 Correct 72 ms 1088 KB Output is correct
18 Correct 28 ms 1088 KB Output is correct
19 Correct 52 ms 1088 KB Output is correct
20 Correct 24 ms 1088 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 72 ms 1088 KB Output is correct
2 Correct 76 ms 1088 KB Output is correct
3 Correct 76 ms 1088 KB Output is correct
4 Correct 80 ms 1088 KB Output is correct
5 Correct 104 ms 1088 KB Output is correct
6 Correct 140 ms 1088 KB Output is correct
7 Correct 100 ms 1088 KB Output is correct
8 Correct 132 ms 1088 KB Output is correct
9 Correct 192 ms 1088 KB Output is correct
10 Correct 104 ms 1088 KB Output is correct
11 Correct 256 ms 1088 KB Output is correct
12 Correct 248 ms 1088 KB Output is correct
13 Correct 212 ms 1088 KB Output is correct
14 Correct 260 ms 1088 KB Output is correct
15 Correct 240 ms 1088 KB Output is correct
16 Correct 340 ms 1088 KB Output is correct
17 Correct 344 ms 1088 KB Output is correct
18 Correct 264 ms 1088 KB Output is correct
19 Correct 244 ms 1088 KB Output is correct
20 Correct 260 ms 1088 KB Output is correct
21 Correct 816 ms 1088 KB Output is correct
22 Correct 824 ms 1088 KB Output is correct
23 Correct 572 ms 1088 KB Output is correct
24 Correct 492 ms 1088 KB Output is correct
25 Correct 524 ms 1088 KB Output is correct
26 Correct 200 ms 1088 KB Output is correct
27 Correct 232 ms 1088 KB Output is correct
28 Correct 232 ms 1088 KB Output is correct
29 Correct 208 ms 1088 KB Output is correct
30 Correct 208 ms 1088 KB Output is correct