Submission #731

# Submission time Handle Problem Language Result Execution time Memory
731 2013-03-01T12:28:28 Z jyuno426 지도 색칠하기 (GA3_map) C++
85 / 120
1500 ms 924 KB
#include <algorithm>

int map[30][30];
int chk[30];

inline long long mapping(int num)
{
	if(num <= 0) return 1;
	bool color[5];
	register int i;
	long long ans = 0;

	for(i=1;i<=4;i++) color[i] = false;

	for(i=1;i<=map[num][0];i++)
	{
		if(map[num][i] <= num) break;
		color[chk[map[num][i]]] = true;
	}
	
	if(map[num][0] == 0) ans += 4 * mapping(num-1);
	else for(i=1;i<=4;i++)
	{
		if(!color[i])
		{
			chk[num] = i;
			ans += mapping(num-1);
			chk[num] = 0;
		}
	}

	return ans;
}

bool cmp(int aa, int bb){return aa > bb;}

long long NumberOfMaps (int N, int M, int *A, int *B){

	int i;

	for(i=0;i<M;i++)
	{
		map[A[i]][++map[A[i]][0]] = B[i];
		map[B[i]][++map[B[i]][0]] = A[i];
	}

	for(i=1;i<=N;i++) std::sort(map[i]+1,map[i]+(map[i][0]+1),cmp);

	return mapping(N);
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 924 KB Output is correct
2 Correct 0 ms 924 KB Output is correct
3 Correct 0 ms 924 KB Output is correct
4 Correct 0 ms 924 KB Output is correct
5 Correct 0 ms 924 KB Output is correct
6 Correct 0 ms 924 KB Output is correct
7 Correct 0 ms 924 KB Output is correct
8 Correct 0 ms 924 KB Output is correct
9 Correct 0 ms 924 KB Output is correct
10 Correct 0 ms 924 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 924 KB Output is correct
2 Correct 0 ms 924 KB Output is correct
3 Correct 0 ms 924 KB Output is correct
4 Correct 0 ms 924 KB Output is correct
5 Correct 0 ms 924 KB Output is correct
6 Correct 0 ms 924 KB Output is correct
7 Correct 0 ms 924 KB Output is correct
8 Correct 0 ms 924 KB Output is correct
9 Correct 0 ms 924 KB Output is correct
10 Correct 0 ms 924 KB Output is correct
11 Correct 0 ms 924 KB Output is correct
12 Correct 0 ms 924 KB Output is correct
13 Correct 0 ms 924 KB Output is correct
14 Correct 0 ms 924 KB Output is correct
15 Correct 0 ms 924 KB Output is correct
16 Correct 0 ms 924 KB Output is correct
17 Correct 0 ms 924 KB Output is correct
18 Correct 0 ms 924 KB Output is correct
19 Correct 0 ms 924 KB Output is correct
20 Correct 0 ms 924 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 924 KB Output is correct
2 Correct 0 ms 924 KB Output is correct
3 Correct 0 ms 924 KB Output is correct
4 Correct 0 ms 924 KB Output is correct
5 Correct 0 ms 924 KB Output is correct
6 Correct 22 ms 924 KB Output is correct
7 Correct 5 ms 924 KB Output is correct
8 Correct 6 ms 924 KB Output is correct
9 Correct 12 ms 924 KB Output is correct
10 Correct 9 ms 924 KB Output is correct
11 Correct 0 ms 924 KB Output is correct
12 Correct 0 ms 924 KB Output is correct
13 Correct 0 ms 924 KB Output is correct
14 Correct 0 ms 924 KB Output is correct
15 Correct 0 ms 924 KB Output is correct
16 Correct 3 ms 924 KB Output is correct
17 Correct 1 ms 924 KB Output is correct
18 Correct 0 ms 924 KB Output is correct
19 Correct 0 ms 924 KB Output is correct
20 Correct 0 ms 924 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 924 KB Output is correct
2 Correct 0 ms 924 KB Output is correct
3 Correct 0 ms 924 KB Output is correct
4 Correct 372 ms 924 KB Output is correct
5 Correct 0 ms 924 KB Output is correct
6 Correct 39 ms 924 KB Output is correct
7 Correct 224 ms 924 KB Output is correct
8 Correct 1 ms 924 KB Output is correct
9 Correct 6 ms 924 KB Output is correct
10 Correct 23 ms 924 KB Output is correct
11 Correct 0 ms 924 KB Output is correct
12 Correct 0 ms 924 KB Output is correct
13 Correct 0 ms 924 KB Output is correct
14 Correct 0 ms 924 KB Output is correct
15 Correct 0 ms 924 KB Output is correct
16 Correct 42 ms 924 KB Output is correct
17 Correct 32 ms 924 KB Output is correct
18 Correct 0 ms 924 KB Output is correct
19 Correct 0 ms 924 KB Output is correct
20 Correct 0 ms 924 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 924 KB Output is correct
2 Correct 0 ms 924 KB Output is correct
3 Correct 0 ms 924 KB Output is correct
4 Correct 0 ms 924 KB Output is correct
5 Execution timed out 1500 ms 0 KB Program timed out
6 Halted 0 ms 0 KB -
7 Halted 0 ms 0 KB -
8 Halted 0 ms 0 KB -
9 Halted 0 ms 0 KB -
10 Halted 0 ms 0 KB -
11 Halted 0 ms 0 KB -
12 Halted 0 ms 0 KB -
13 Halted 0 ms 0 KB -
14 Halted 0 ms 0 KB -
15 Halted 0 ms 0 KB -
16 Halted 0 ms 0 KB -
17 Halted 0 ms 0 KB -
18 Halted 0 ms 0 KB -
19 Halted 0 ms 0 KB -
20 Halted 0 ms 0 KB -
21 Halted 0 ms 0 KB -
22 Halted 0 ms 0 KB -
23 Halted 0 ms 0 KB -
24 Halted 0 ms 0 KB -
25 Halted 0 ms 0 KB -
26 Halted 0 ms 0 KB -
27 Halted 0 ms 0 KB -
28 Halted 0 ms 0 KB -
29 Halted 0 ms 0 KB -
30 Halted 0 ms 0 KB -