#include "game.h"
#include <bits/stdc++.h>
using namespace std;
vector<int> adj[300000];
int n, k;
vector<int> vis;
void init(int N, int K) {
n = N; k = K;
vis.resize(n);
for(int i=0;i<k-1;i++) adj[i].push_back(i + 1);
}
bool dfs(int i) {
if (vis[i] == 2) return true;
if (vis[i] == 1) return i >= k;
vis[i] = 1;
for(auto j:adj[i])
{
if (!dfs(j)) return false;
}
vis[i] = 2;
return true;
}
int add_teleporter(int u, int v)
{
for (int i = 0; i < n; i++) vis[i] = 0;
adj[u].push_back(v);
bool ok = dfs(0);
return ok ? 0 : 1;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
5 ms |
7248 KB |
Output is correct |
2 |
Correct |
3 ms |
7248 KB |
Output is correct |
3 |
Correct |
4 ms |
7248 KB |
Output is correct |
4 |
Correct |
3 ms |
7248 KB |
Output is correct |
5 |
Correct |
5 ms |
7248 KB |
Output is correct |
6 |
Correct |
4 ms |
7248 KB |
Output is correct |
7 |
Correct |
4 ms |
7248 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
5 ms |
7248 KB |
Output is correct |
2 |
Correct |
3 ms |
7248 KB |
Output is correct |
3 |
Correct |
4 ms |
7248 KB |
Output is correct |
4 |
Correct |
3 ms |
7248 KB |
Output is correct |
5 |
Correct |
5 ms |
7248 KB |
Output is correct |
6 |
Correct |
4 ms |
7248 KB |
Output is correct |
7 |
Correct |
4 ms |
7248 KB |
Output is correct |
8 |
Correct |
4 ms |
7248 KB |
Output is correct |
9 |
Correct |
3 ms |
7248 KB |
Output is correct |
10 |
Correct |
3 ms |
7248 KB |
Output is correct |
11 |
Correct |
4 ms |
7248 KB |
Output is correct |
12 |
Correct |
3 ms |
7248 KB |
Output is correct |
13 |
Correct |
4 ms |
7248 KB |
Output is correct |
14 |
Correct |
4 ms |
7240 KB |
Output is correct |
15 |
Correct |
4 ms |
7248 KB |
Output is correct |
16 |
Correct |
4 ms |
7248 KB |
Output is correct |
17 |
Correct |
4 ms |
7248 KB |
Output is correct |
18 |
Correct |
4 ms |
7240 KB |
Output is correct |
19 |
Correct |
4 ms |
7248 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
5 ms |
7248 KB |
Output is correct |
2 |
Correct |
3 ms |
7248 KB |
Output is correct |
3 |
Correct |
4 ms |
7248 KB |
Output is correct |
4 |
Correct |
3 ms |
7248 KB |
Output is correct |
5 |
Correct |
5 ms |
7248 KB |
Output is correct |
6 |
Correct |
4 ms |
7248 KB |
Output is correct |
7 |
Correct |
4 ms |
7248 KB |
Output is correct |
8 |
Correct |
4 ms |
7248 KB |
Output is correct |
9 |
Correct |
3 ms |
7248 KB |
Output is correct |
10 |
Correct |
3 ms |
7248 KB |
Output is correct |
11 |
Correct |
4 ms |
7248 KB |
Output is correct |
12 |
Correct |
3 ms |
7248 KB |
Output is correct |
13 |
Correct |
4 ms |
7248 KB |
Output is correct |
14 |
Correct |
4 ms |
7240 KB |
Output is correct |
15 |
Correct |
4 ms |
7248 KB |
Output is correct |
16 |
Correct |
4 ms |
7248 KB |
Output is correct |
17 |
Correct |
4 ms |
7248 KB |
Output is correct |
18 |
Correct |
4 ms |
7240 KB |
Output is correct |
19 |
Correct |
4 ms |
7248 KB |
Output is correct |
20 |
Correct |
5 ms |
7376 KB |
Output is correct |
21 |
Correct |
5 ms |
7248 KB |
Output is correct |
22 |
Correct |
6 ms |
7376 KB |
Output is correct |
23 |
Correct |
5 ms |
7376 KB |
Output is correct |
24 |
Correct |
14 ms |
7376 KB |
Output is correct |
25 |
Correct |
45 ms |
7376 KB |
Output is correct |
26 |
Correct |
66 ms |
7388 KB |
Output is correct |
27 |
Correct |
75 ms |
7376 KB |
Output is correct |
28 |
Correct |
23 ms |
7392 KB |
Output is correct |
29 |
Correct |
55 ms |
7388 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
5 ms |
7248 KB |
Output is correct |
2 |
Correct |
3 ms |
7248 KB |
Output is correct |
3 |
Correct |
4 ms |
7248 KB |
Output is correct |
4 |
Correct |
3 ms |
7248 KB |
Output is correct |
5 |
Correct |
5 ms |
7248 KB |
Output is correct |
6 |
Correct |
4 ms |
7248 KB |
Output is correct |
7 |
Correct |
4 ms |
7248 KB |
Output is correct |
8 |
Correct |
4 ms |
7248 KB |
Output is correct |
9 |
Correct |
3 ms |
7248 KB |
Output is correct |
10 |
Correct |
3 ms |
7248 KB |
Output is correct |
11 |
Correct |
4 ms |
7248 KB |
Output is correct |
12 |
Correct |
3 ms |
7248 KB |
Output is correct |
13 |
Correct |
4 ms |
7248 KB |
Output is correct |
14 |
Correct |
4 ms |
7240 KB |
Output is correct |
15 |
Correct |
4 ms |
7248 KB |
Output is correct |
16 |
Correct |
4 ms |
7248 KB |
Output is correct |
17 |
Correct |
4 ms |
7248 KB |
Output is correct |
18 |
Correct |
4 ms |
7240 KB |
Output is correct |
19 |
Correct |
4 ms |
7248 KB |
Output is correct |
20 |
Correct |
5 ms |
7376 KB |
Output is correct |
21 |
Correct |
5 ms |
7248 KB |
Output is correct |
22 |
Correct |
6 ms |
7376 KB |
Output is correct |
23 |
Correct |
5 ms |
7376 KB |
Output is correct |
24 |
Correct |
14 ms |
7376 KB |
Output is correct |
25 |
Correct |
45 ms |
7376 KB |
Output is correct |
26 |
Correct |
66 ms |
7388 KB |
Output is correct |
27 |
Correct |
75 ms |
7376 KB |
Output is correct |
28 |
Correct |
23 ms |
7392 KB |
Output is correct |
29 |
Correct |
55 ms |
7388 KB |
Output is correct |
30 |
Correct |
501 ms |
7992 KB |
Output is correct |
31 |
Correct |
178 ms |
7660 KB |
Output is correct |
32 |
Correct |
438 ms |
8788 KB |
Output is correct |
33 |
Correct |
430 ms |
8520 KB |
Output is correct |
34 |
Correct |
1543 ms |
9324 KB |
Output is correct |
35 |
Execution timed out |
4030 ms |
8336 KB |
Time limit exceeded |
36 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
5 ms |
7248 KB |
Output is correct |
2 |
Correct |
3 ms |
7248 KB |
Output is correct |
3 |
Correct |
4 ms |
7248 KB |
Output is correct |
4 |
Correct |
3 ms |
7248 KB |
Output is correct |
5 |
Correct |
5 ms |
7248 KB |
Output is correct |
6 |
Correct |
4 ms |
7248 KB |
Output is correct |
7 |
Correct |
4 ms |
7248 KB |
Output is correct |
8 |
Correct |
4 ms |
7248 KB |
Output is correct |
9 |
Correct |
3 ms |
7248 KB |
Output is correct |
10 |
Correct |
3 ms |
7248 KB |
Output is correct |
11 |
Correct |
4 ms |
7248 KB |
Output is correct |
12 |
Correct |
3 ms |
7248 KB |
Output is correct |
13 |
Correct |
4 ms |
7248 KB |
Output is correct |
14 |
Correct |
4 ms |
7240 KB |
Output is correct |
15 |
Correct |
4 ms |
7248 KB |
Output is correct |
16 |
Correct |
4 ms |
7248 KB |
Output is correct |
17 |
Correct |
4 ms |
7248 KB |
Output is correct |
18 |
Correct |
4 ms |
7240 KB |
Output is correct |
19 |
Correct |
4 ms |
7248 KB |
Output is correct |
20 |
Correct |
5 ms |
7376 KB |
Output is correct |
21 |
Correct |
5 ms |
7248 KB |
Output is correct |
22 |
Correct |
6 ms |
7376 KB |
Output is correct |
23 |
Correct |
5 ms |
7376 KB |
Output is correct |
24 |
Correct |
14 ms |
7376 KB |
Output is correct |
25 |
Correct |
45 ms |
7376 KB |
Output is correct |
26 |
Correct |
66 ms |
7388 KB |
Output is correct |
27 |
Correct |
75 ms |
7376 KB |
Output is correct |
28 |
Correct |
23 ms |
7392 KB |
Output is correct |
29 |
Correct |
55 ms |
7388 KB |
Output is correct |
30 |
Correct |
501 ms |
7992 KB |
Output is correct |
31 |
Correct |
178 ms |
7660 KB |
Output is correct |
32 |
Correct |
438 ms |
8788 KB |
Output is correct |
33 |
Correct |
430 ms |
8520 KB |
Output is correct |
34 |
Correct |
1543 ms |
9324 KB |
Output is correct |
35 |
Execution timed out |
4030 ms |
8336 KB |
Time limit exceeded |
36 |
Halted |
0 ms |
0 KB |
- |