#include "game.h"
#include <bits/stdc++.h>
using namespace std;
vector<int> g[1024];
int n, k;
void init(int n, int k) {
::n = n;
::k = k;
}
int color[1024];
bool dfs(int i) {
if (color[i] == 2)
return true;
if (color[i] == 1)
return false;
color[i] = 1;
for (int j : g[i]) {
if (!dfs(j))
return false;
}
color[i] = 2;
return true;
}
int add_teleporter(int u, int v) {
memset(color, 0, sizeof(color));
g[u].push_back(v);
bool ok = true;
for (int i = 0; i < k; i++) {
ok &= dfs(i);
}
return ok ? 0 : 1;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
208 KB |
Output is correct |
2 |
Correct |
0 ms |
208 KB |
Output is correct |
3 |
Correct |
1 ms |
208 KB |
Output is correct |
4 |
Incorrect |
0 ms |
452 KB |
Wrong Answer[1] |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
208 KB |
Output is correct |
2 |
Correct |
0 ms |
208 KB |
Output is correct |
3 |
Correct |
1 ms |
208 KB |
Output is correct |
4 |
Incorrect |
0 ms |
452 KB |
Wrong Answer[1] |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
208 KB |
Output is correct |
2 |
Correct |
0 ms |
208 KB |
Output is correct |
3 |
Correct |
1 ms |
208 KB |
Output is correct |
4 |
Incorrect |
0 ms |
452 KB |
Wrong Answer[1] |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
208 KB |
Output is correct |
2 |
Correct |
0 ms |
208 KB |
Output is correct |
3 |
Correct |
1 ms |
208 KB |
Output is correct |
4 |
Incorrect |
0 ms |
452 KB |
Wrong Answer[1] |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
208 KB |
Output is correct |
2 |
Correct |
0 ms |
208 KB |
Output is correct |
3 |
Correct |
1 ms |
208 KB |
Output is correct |
4 |
Incorrect |
0 ms |
452 KB |
Wrong Answer[1] |
5 |
Halted |
0 ms |
0 KB |
- |