#include <vector>
using namespace std;
int n;
int color[21];
vector<int> v[21];
long long brute(int pos)
{
if(pos == n) return 1;
long long cnt = 0;
vector<int>::iterator iter;
for(int i = 1;i <= 4;i++)
{
color[pos] = i;
for(iter = v[pos].begin();iter != v[pos].end();++iter)
if(color[*iter] == color[pos])
break;
if(iter == v[pos].end())
cnt += brute(pos + 1);
}
color[pos] = 0;
return cnt;
}
long long NumberOfMaps (int N, int M, int *A, int *B)
{
n = N + 1;
for(int i = 0;i < M;i++)
{
v[A[i]].push_back(B[i]);
v[B[i]].push_back(A[i]);
}
return brute(1);
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
940 KB |
Output is correct |
2 |
Correct |
0 ms |
940 KB |
Output is correct |
3 |
Correct |
0 ms |
940 KB |
Output is correct |
4 |
Correct |
0 ms |
940 KB |
Output is correct |
5 |
Correct |
0 ms |
940 KB |
Output is correct |
6 |
Correct |
0 ms |
940 KB |
Output is correct |
7 |
Correct |
0 ms |
940 KB |
Output is correct |
8 |
Correct |
0 ms |
940 KB |
Output is correct |
9 |
Correct |
0 ms |
940 KB |
Output is correct |
10 |
Correct |
0 ms |
940 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
8 ms |
940 KB |
Output is correct |
2 |
Correct |
36 ms |
940 KB |
Output is correct |
3 |
Correct |
30 ms |
940 KB |
Output is correct |
4 |
Correct |
10 ms |
940 KB |
Output is correct |
5 |
Correct |
0 ms |
940 KB |
Output is correct |
6 |
Correct |
0 ms |
940 KB |
Output is correct |
7 |
Correct |
0 ms |
940 KB |
Output is correct |
8 |
Correct |
0 ms |
940 KB |
Output is correct |
9 |
Correct |
0 ms |
940 KB |
Output is correct |
10 |
Correct |
1 ms |
940 KB |
Output is correct |
11 |
Correct |
0 ms |
940 KB |
Output is correct |
12 |
Correct |
0 ms |
940 KB |
Output is correct |
13 |
Correct |
0 ms |
940 KB |
Output is correct |
14 |
Correct |
0 ms |
940 KB |
Output is correct |
15 |
Correct |
0 ms |
940 KB |
Output is correct |
16 |
Correct |
0 ms |
940 KB |
Output is correct |
17 |
Correct |
0 ms |
940 KB |
Output is correct |
18 |
Correct |
0 ms |
940 KB |
Output is correct |
19 |
Correct |
0 ms |
940 KB |
Output is correct |
20 |
Correct |
0 ms |
940 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1500 ms |
0 KB |
Program timed out |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1500 ms |
0 KB |
Program timed out |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1500 ms |
0 KB |
Program timed out |
2 |
Halted |
0 ms |
0 KB |
- |
3 |
Halted |
0 ms |
0 KB |
- |
4 |
Halted |
0 ms |
0 KB |
- |
5 |
Halted |
0 ms |
0 KB |
- |
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 |
- |