#include "game.h"
#include <bits/stdc++.h>
using namespace std;
vector<int> g[300005];
int n, k;
void init(int _n, int _k) {
n = _n;
k = _k;
for(int i = 1; i < k; ++i) {
g[i-1].push_back(i);
}
}
bool used[300005], ok;
int root;
void dfs(int v) {
used[v] = 1;
for(auto to : g[v]) {
if(!used[to]) {
dfs(to);
}
}
}
int add_teleporter(int u, int v) {
g[u].push_back(v);
for(int i = 0; i < k; ++i) {
fill(used, used+n, 0);
dfs(i);
for(int j = 0; j < n; ++j) {
if(used[j]) {
for(auto to : g[j]) {
if(to == i) {
return 1;
}
}
}
}
}
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
7512 KB |
Output is correct |
2 |
Correct |
3 ms |
7512 KB |
Output is correct |
3 |
Correct |
18 ms |
7596 KB |
Output is correct |
4 |
Correct |
3 ms |
7512 KB |
Output is correct |
5 |
Correct |
17 ms |
7512 KB |
Output is correct |
6 |
Correct |
17 ms |
7512 KB |
Output is correct |
7 |
Correct |
18 ms |
7512 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
7512 KB |
Output is correct |
2 |
Correct |
3 ms |
7512 KB |
Output is correct |
3 |
Correct |
18 ms |
7596 KB |
Output is correct |
4 |
Correct |
3 ms |
7512 KB |
Output is correct |
5 |
Correct |
17 ms |
7512 KB |
Output is correct |
6 |
Correct |
17 ms |
7512 KB |
Output is correct |
7 |
Correct |
18 ms |
7512 KB |
Output is correct |
8 |
Correct |
2 ms |
7512 KB |
Output is correct |
9 |
Correct |
2 ms |
7512 KB |
Output is correct |
10 |
Correct |
2 ms |
7512 KB |
Output is correct |
11 |
Correct |
3 ms |
7768 KB |
Output is correct |
12 |
Correct |
2 ms |
7512 KB |
Output is correct |
13 |
Correct |
2 ms |
7512 KB |
Output is correct |
14 |
Correct |
3 ms |
7512 KB |
Output is correct |
15 |
Correct |
4 ms |
7512 KB |
Output is correct |
16 |
Correct |
3 ms |
7512 KB |
Output is correct |
17 |
Correct |
9 ms |
7512 KB |
Output is correct |
18 |
Correct |
4 ms |
7512 KB |
Output is correct |
19 |
Correct |
5 ms |
7512 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
7512 KB |
Output is correct |
2 |
Correct |
3 ms |
7512 KB |
Output is correct |
3 |
Correct |
18 ms |
7596 KB |
Output is correct |
4 |
Correct |
3 ms |
7512 KB |
Output is correct |
5 |
Correct |
17 ms |
7512 KB |
Output is correct |
6 |
Correct |
17 ms |
7512 KB |
Output is correct |
7 |
Correct |
18 ms |
7512 KB |
Output is correct |
8 |
Correct |
2 ms |
7512 KB |
Output is correct |
9 |
Correct |
2 ms |
7512 KB |
Output is correct |
10 |
Correct |
2 ms |
7512 KB |
Output is correct |
11 |
Correct |
3 ms |
7768 KB |
Output is correct |
12 |
Correct |
2 ms |
7512 KB |
Output is correct |
13 |
Correct |
2 ms |
7512 KB |
Output is correct |
14 |
Correct |
3 ms |
7512 KB |
Output is correct |
15 |
Correct |
4 ms |
7512 KB |
Output is correct |
16 |
Correct |
3 ms |
7512 KB |
Output is correct |
17 |
Correct |
9 ms |
7512 KB |
Output is correct |
18 |
Correct |
4 ms |
7512 KB |
Output is correct |
19 |
Correct |
5 ms |
7512 KB |
Output is correct |
20 |
Correct |
7 ms |
8024 KB |
Output is correct |
21 |
Correct |
12 ms |
7588 KB |
Output is correct |
22 |
Correct |
71 ms |
7848 KB |
Output is correct |
23 |
Correct |
7 ms |
7512 KB |
Output is correct |
24 |
Correct |
1299 ms |
7760 KB |
Output is correct |
25 |
Execution timed out |
4013 ms |
7860 KB |
Time limit exceeded |
26 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
7512 KB |
Output is correct |
2 |
Correct |
3 ms |
7512 KB |
Output is correct |
3 |
Correct |
18 ms |
7596 KB |
Output is correct |
4 |
Correct |
3 ms |
7512 KB |
Output is correct |
5 |
Correct |
17 ms |
7512 KB |
Output is correct |
6 |
Correct |
17 ms |
7512 KB |
Output is correct |
7 |
Correct |
18 ms |
7512 KB |
Output is correct |
8 |
Correct |
2 ms |
7512 KB |
Output is correct |
9 |
Correct |
2 ms |
7512 KB |
Output is correct |
10 |
Correct |
2 ms |
7512 KB |
Output is correct |
11 |
Correct |
3 ms |
7768 KB |
Output is correct |
12 |
Correct |
2 ms |
7512 KB |
Output is correct |
13 |
Correct |
2 ms |
7512 KB |
Output is correct |
14 |
Correct |
3 ms |
7512 KB |
Output is correct |
15 |
Correct |
4 ms |
7512 KB |
Output is correct |
16 |
Correct |
3 ms |
7512 KB |
Output is correct |
17 |
Correct |
9 ms |
7512 KB |
Output is correct |
18 |
Correct |
4 ms |
7512 KB |
Output is correct |
19 |
Correct |
5 ms |
7512 KB |
Output is correct |
20 |
Correct |
7 ms |
8024 KB |
Output is correct |
21 |
Correct |
12 ms |
7588 KB |
Output is correct |
22 |
Correct |
71 ms |
7848 KB |
Output is correct |
23 |
Correct |
7 ms |
7512 KB |
Output is correct |
24 |
Correct |
1299 ms |
7760 KB |
Output is correct |
25 |
Execution timed out |
4013 ms |
7860 KB |
Time limit exceeded |
26 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
7512 KB |
Output is correct |
2 |
Correct |
3 ms |
7512 KB |
Output is correct |
3 |
Correct |
18 ms |
7596 KB |
Output is correct |
4 |
Correct |
3 ms |
7512 KB |
Output is correct |
5 |
Correct |
17 ms |
7512 KB |
Output is correct |
6 |
Correct |
17 ms |
7512 KB |
Output is correct |
7 |
Correct |
18 ms |
7512 KB |
Output is correct |
8 |
Correct |
2 ms |
7512 KB |
Output is correct |
9 |
Correct |
2 ms |
7512 KB |
Output is correct |
10 |
Correct |
2 ms |
7512 KB |
Output is correct |
11 |
Correct |
3 ms |
7768 KB |
Output is correct |
12 |
Correct |
2 ms |
7512 KB |
Output is correct |
13 |
Correct |
2 ms |
7512 KB |
Output is correct |
14 |
Correct |
3 ms |
7512 KB |
Output is correct |
15 |
Correct |
4 ms |
7512 KB |
Output is correct |
16 |
Correct |
3 ms |
7512 KB |
Output is correct |
17 |
Correct |
9 ms |
7512 KB |
Output is correct |
18 |
Correct |
4 ms |
7512 KB |
Output is correct |
19 |
Correct |
5 ms |
7512 KB |
Output is correct |
20 |
Correct |
7 ms |
8024 KB |
Output is correct |
21 |
Correct |
12 ms |
7588 KB |
Output is correct |
22 |
Correct |
71 ms |
7848 KB |
Output is correct |
23 |
Correct |
7 ms |
7512 KB |
Output is correct |
24 |
Correct |
1299 ms |
7760 KB |
Output is correct |
25 |
Execution timed out |
4013 ms |
7860 KB |
Time limit exceeded |
26 |
Halted |
0 ms |
0 KB |
- |