#include "game.h"
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vll = vector <ll>;
const ll MAXN = 3E5+16;
int n, k;
vll adj[MAXN];
void init (int n, int k) {
::n = n, ::k = k;
for (ll i = 1; i < k; i++) {
adj[i-1].push_back(i);
}
}
ll tvis[MAXN];
ll timer = 1;
ll dfs (ll u, ll par, ll lastK) {
if (tvis[u] == timer) return 0;
tvis[u] = timer;
for (ll v : adj[u]) {
if (v <= lastK) return 1;
if (dfs(v, u, (v < k ? v : lastK))) return 1;
}
return 0;
}
int add_teleporter (int u, int v) {
adj[u].push_back(v);
timer++;
return dfs(0, 0, 0);
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
7512 KB |
Output is correct |
2 |
Correct |
2 ms |
7512 KB |
Output is correct |
3 |
Correct |
2 ms |
7512 KB |
Output is correct |
4 |
Correct |
2 ms |
7512 KB |
Output is correct |
5 |
Correct |
2 ms |
7512 KB |
Output is correct |
6 |
Correct |
2 ms |
7764 KB |
Output is correct |
7 |
Correct |
2 ms |
7512 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
7512 KB |
Output is correct |
2 |
Correct |
2 ms |
7512 KB |
Output is correct |
3 |
Correct |
2 ms |
7512 KB |
Output is correct |
4 |
Correct |
2 ms |
7512 KB |
Output is correct |
5 |
Correct |
2 ms |
7512 KB |
Output is correct |
6 |
Correct |
2 ms |
7764 KB |
Output is correct |
7 |
Correct |
2 ms |
7512 KB |
Output is correct |
8 |
Correct |
2 ms |
7512 KB |
Output is correct |
9 |
Correct |
3 ms |
7508 KB |
Output is correct |
10 |
Correct |
2 ms |
7512 KB |
Output is correct |
11 |
Correct |
2 ms |
7512 KB |
Output is correct |
12 |
Correct |
2 ms |
7412 KB |
Output is correct |
13 |
Correct |
2 ms |
7512 KB |
Output is correct |
14 |
Correct |
2 ms |
7512 KB |
Output is correct |
15 |
Correct |
2 ms |
7512 KB |
Output is correct |
16 |
Correct |
2 ms |
7512 KB |
Output is correct |
17 |
Correct |
2 ms |
7512 KB |
Output is correct |
18 |
Correct |
2 ms |
7512 KB |
Output is correct |
19 |
Correct |
2 ms |
7512 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
7512 KB |
Output is correct |
2 |
Correct |
2 ms |
7512 KB |
Output is correct |
3 |
Correct |
2 ms |
7512 KB |
Output is correct |
4 |
Correct |
2 ms |
7512 KB |
Output is correct |
5 |
Correct |
2 ms |
7512 KB |
Output is correct |
6 |
Correct |
2 ms |
7764 KB |
Output is correct |
7 |
Correct |
2 ms |
7512 KB |
Output is correct |
8 |
Correct |
2 ms |
7512 KB |
Output is correct |
9 |
Correct |
3 ms |
7508 KB |
Output is correct |
10 |
Correct |
2 ms |
7512 KB |
Output is correct |
11 |
Correct |
2 ms |
7512 KB |
Output is correct |
12 |
Correct |
2 ms |
7412 KB |
Output is correct |
13 |
Correct |
2 ms |
7512 KB |
Output is correct |
14 |
Correct |
2 ms |
7512 KB |
Output is correct |
15 |
Correct |
2 ms |
7512 KB |
Output is correct |
16 |
Correct |
2 ms |
7512 KB |
Output is correct |
17 |
Correct |
2 ms |
7512 KB |
Output is correct |
18 |
Correct |
2 ms |
7512 KB |
Output is correct |
19 |
Correct |
2 ms |
7512 KB |
Output is correct |
20 |
Correct |
2 ms |
7512 KB |
Output is correct |
21 |
Correct |
2 ms |
7512 KB |
Output is correct |
22 |
Correct |
2 ms |
7512 KB |
Output is correct |
23 |
Correct |
2 ms |
7596 KB |
Output is correct |
24 |
Correct |
7 ms |
7768 KB |
Output is correct |
25 |
Correct |
30 ms |
8176 KB |
Output is correct |
26 |
Correct |
38 ms |
8024 KB |
Output is correct |
27 |
Correct |
45 ms |
7788 KB |
Output is correct |
28 |
Correct |
19 ms |
7512 KB |
Output is correct |
29 |
Correct |
36 ms |
7760 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
7512 KB |
Output is correct |
2 |
Correct |
2 ms |
7512 KB |
Output is correct |
3 |
Correct |
2 ms |
7512 KB |
Output is correct |
4 |
Correct |
2 ms |
7512 KB |
Output is correct |
5 |
Correct |
2 ms |
7512 KB |
Output is correct |
6 |
Correct |
2 ms |
7764 KB |
Output is correct |
7 |
Correct |
2 ms |
7512 KB |
Output is correct |
8 |
Correct |
2 ms |
7512 KB |
Output is correct |
9 |
Correct |
3 ms |
7508 KB |
Output is correct |
10 |
Correct |
2 ms |
7512 KB |
Output is correct |
11 |
Correct |
2 ms |
7512 KB |
Output is correct |
12 |
Correct |
2 ms |
7412 KB |
Output is correct |
13 |
Correct |
2 ms |
7512 KB |
Output is correct |
14 |
Correct |
2 ms |
7512 KB |
Output is correct |
15 |
Correct |
2 ms |
7512 KB |
Output is correct |
16 |
Correct |
2 ms |
7512 KB |
Output is correct |
17 |
Correct |
2 ms |
7512 KB |
Output is correct |
18 |
Correct |
2 ms |
7512 KB |
Output is correct |
19 |
Correct |
2 ms |
7512 KB |
Output is correct |
20 |
Correct |
2 ms |
7512 KB |
Output is correct |
21 |
Correct |
2 ms |
7512 KB |
Output is correct |
22 |
Correct |
2 ms |
7512 KB |
Output is correct |
23 |
Correct |
2 ms |
7596 KB |
Output is correct |
24 |
Correct |
7 ms |
7768 KB |
Output is correct |
25 |
Correct |
30 ms |
8176 KB |
Output is correct |
26 |
Correct |
38 ms |
8024 KB |
Output is correct |
27 |
Correct |
45 ms |
7788 KB |
Output is correct |
28 |
Correct |
19 ms |
7512 KB |
Output is correct |
29 |
Correct |
36 ms |
7760 KB |
Output is correct |
30 |
Correct |
84 ms |
9092 KB |
Output is correct |
31 |
Correct |
54 ms |
8016 KB |
Output is correct |
32 |
Correct |
41 ms |
9836 KB |
Output is correct |
33 |
Correct |
20 ms |
9096 KB |
Output is correct |
34 |
Correct |
1008 ms |
10300 KB |
Output is correct |
35 |
Execution timed out |
4026 ms |
9244 KB |
Time limit exceeded |
36 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
7512 KB |
Output is correct |
2 |
Correct |
2 ms |
7512 KB |
Output is correct |
3 |
Correct |
2 ms |
7512 KB |
Output is correct |
4 |
Correct |
2 ms |
7512 KB |
Output is correct |
5 |
Correct |
2 ms |
7512 KB |
Output is correct |
6 |
Correct |
2 ms |
7764 KB |
Output is correct |
7 |
Correct |
2 ms |
7512 KB |
Output is correct |
8 |
Correct |
2 ms |
7512 KB |
Output is correct |
9 |
Correct |
3 ms |
7508 KB |
Output is correct |
10 |
Correct |
2 ms |
7512 KB |
Output is correct |
11 |
Correct |
2 ms |
7512 KB |
Output is correct |
12 |
Correct |
2 ms |
7412 KB |
Output is correct |
13 |
Correct |
2 ms |
7512 KB |
Output is correct |
14 |
Correct |
2 ms |
7512 KB |
Output is correct |
15 |
Correct |
2 ms |
7512 KB |
Output is correct |
16 |
Correct |
2 ms |
7512 KB |
Output is correct |
17 |
Correct |
2 ms |
7512 KB |
Output is correct |
18 |
Correct |
2 ms |
7512 KB |
Output is correct |
19 |
Correct |
2 ms |
7512 KB |
Output is correct |
20 |
Correct |
2 ms |
7512 KB |
Output is correct |
21 |
Correct |
2 ms |
7512 KB |
Output is correct |
22 |
Correct |
2 ms |
7512 KB |
Output is correct |
23 |
Correct |
2 ms |
7596 KB |
Output is correct |
24 |
Correct |
7 ms |
7768 KB |
Output is correct |
25 |
Correct |
30 ms |
8176 KB |
Output is correct |
26 |
Correct |
38 ms |
8024 KB |
Output is correct |
27 |
Correct |
45 ms |
7788 KB |
Output is correct |
28 |
Correct |
19 ms |
7512 KB |
Output is correct |
29 |
Correct |
36 ms |
7760 KB |
Output is correct |
30 |
Correct |
84 ms |
9092 KB |
Output is correct |
31 |
Correct |
54 ms |
8016 KB |
Output is correct |
32 |
Correct |
41 ms |
9836 KB |
Output is correct |
33 |
Correct |
20 ms |
9096 KB |
Output is correct |
34 |
Correct |
1008 ms |
10300 KB |
Output is correct |
35 |
Execution timed out |
4026 ms |
9244 KB |
Time limit exceeded |
36 |
Halted |
0 ms |
0 KB |
- |