답안 #729

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
729 2013-03-01T12:17:45 Z jyuno426 지도 색칠하기 (GA3_map) C++
0 / 120
1500 ms 920 KB
#include <algorithm>

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

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

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

	for(i=1;i<=map[num][i];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);
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 920 KB Output is correct
2 Correct 0 ms 920 KB Output is correct
3 Correct 0 ms 920 KB Output is correct
4 Correct 0 ms 920 KB Output is correct
5 Correct 0 ms 920 KB Output is correct
6 Incorrect 0 ms 920 KB Output isn't correct
7 Halted 0 ms 0 KB -
8 Halted 0 ms 0 KB -
9 Halted 0 ms 0 KB -
10 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 920 KB Output is correct
2 Correct 0 ms 920 KB Output is correct
3 Correct 0 ms 920 KB Output is correct
4 Correct 0 ms 920 KB Output is correct
5 Correct 0 ms 920 KB Output is correct
6 Correct 0 ms 920 KB Output is correct
7 Incorrect 0 ms 920 KB Output isn't correct
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 -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 920 KB Output is correct
2 Correct 0 ms 920 KB Output is correct
3 Correct 0 ms 920 KB Output is correct
4 Correct 0 ms 920 KB Output is correct
5 Correct 0 ms 920 KB Output is correct
6 Correct 20 ms 920 KB Output is correct
7 Incorrect 5 ms 920 KB Output isn't correct
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 -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 920 KB Output is correct
2 Correct 0 ms 920 KB Output is correct
3 Correct 0 ms 920 KB Output is correct
4 Correct 662 ms 920 KB Output is correct
5 Correct 0 ms 920 KB Output is correct
6 Correct 54 ms 920 KB Output is correct
7 Correct 266 ms 920 KB Output is correct
8 Incorrect 2 ms 920 KB Output isn't correct
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 -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 920 KB Output is correct
2 Correct 0 ms 920 KB Output is correct
3 Correct 0 ms 920 KB Output is correct
4 Correct 0 ms 920 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 -