#include "game.h"
#include <bits/stdc++.h>
using namespace std;
vector<int> g[30005];
bool is[1001][30005];
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);
}
for(int i = 0; i < k; ++i) {
for(int j = i; j < k; ++j) {
is[i][j]=1;
}
}
}
bool ok;
void dfs(int v, int root) {
is[root][v] = 1;
for(auto to : g[v]) {
if(to == root) {
ok = 1;
}
if(!is[root][to]) {
dfs(to, root);
}
}
}
int add_teleporter(int u, int v) {
if(v<=u && u<k) {
return 1;
}
g[u].push_back(v);
ok = 0;
for(int i = 0; i < k; ++i) {
if(is[i][u]) {
dfs(u, i);
}
}
return ok;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
1112 KB |
Output is correct |
2 |
Correct |
1 ms |
3160 KB |
Output is correct |
3 |
Correct |
1 ms |
5208 KB |
Output is correct |
4 |
Correct |
1 ms |
3160 KB |
Output is correct |
5 |
Correct |
1 ms |
5208 KB |
Output is correct |
6 |
Correct |
1 ms |
5208 KB |
Output is correct |
7 |
Correct |
1 ms |
5208 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
1112 KB |
Output is correct |
2 |
Correct |
1 ms |
3160 KB |
Output is correct |
3 |
Correct |
1 ms |
5208 KB |
Output is correct |
4 |
Correct |
1 ms |
3160 KB |
Output is correct |
5 |
Correct |
1 ms |
5208 KB |
Output is correct |
6 |
Correct |
1 ms |
5208 KB |
Output is correct |
7 |
Correct |
1 ms |
5208 KB |
Output is correct |
8 |
Correct |
1 ms |
1112 KB |
Output is correct |
9 |
Correct |
0 ms |
1112 KB |
Output is correct |
10 |
Correct |
1 ms |
1112 KB |
Output is correct |
11 |
Correct |
1 ms |
3160 KB |
Output is correct |
12 |
Correct |
1 ms |
3156 KB |
Output is correct |
13 |
Correct |
1 ms |
3160 KB |
Output is correct |
14 |
Correct |
1 ms |
3160 KB |
Output is correct |
15 |
Correct |
1 ms |
3160 KB |
Output is correct |
16 |
Correct |
1 ms |
3160 KB |
Output is correct |
17 |
Correct |
1 ms |
3160 KB |
Output is correct |
18 |
Correct |
1 ms |
3160 KB |
Output is correct |
19 |
Correct |
1 ms |
3160 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
1112 KB |
Output is correct |
2 |
Correct |
1 ms |
3160 KB |
Output is correct |
3 |
Correct |
1 ms |
5208 KB |
Output is correct |
4 |
Correct |
1 ms |
3160 KB |
Output is correct |
5 |
Correct |
1 ms |
5208 KB |
Output is correct |
6 |
Correct |
1 ms |
5208 KB |
Output is correct |
7 |
Correct |
1 ms |
5208 KB |
Output is correct |
8 |
Correct |
1 ms |
1112 KB |
Output is correct |
9 |
Correct |
0 ms |
1112 KB |
Output is correct |
10 |
Correct |
1 ms |
1112 KB |
Output is correct |
11 |
Correct |
1 ms |
3160 KB |
Output is correct |
12 |
Correct |
1 ms |
3156 KB |
Output is correct |
13 |
Correct |
1 ms |
3160 KB |
Output is correct |
14 |
Correct |
1 ms |
3160 KB |
Output is correct |
15 |
Correct |
1 ms |
3160 KB |
Output is correct |
16 |
Correct |
1 ms |
3160 KB |
Output is correct |
17 |
Correct |
1 ms |
3160 KB |
Output is correct |
18 |
Correct |
1 ms |
3160 KB |
Output is correct |
19 |
Correct |
1 ms |
3160 KB |
Output is correct |
20 |
Correct |
1 ms |
3160 KB |
Output is correct |
21 |
Correct |
1 ms |
5208 KB |
Output is correct |
22 |
Correct |
2 ms |
5208 KB |
Output is correct |
23 |
Correct |
1 ms |
3160 KB |
Output is correct |
24 |
Correct |
10 ms |
17496 KB |
Output is correct |
25 |
Correct |
7 ms |
9816 KB |
Output is correct |
26 |
Correct |
5 ms |
5812 KB |
Output is correct |
27 |
Correct |
14 ms |
17912 KB |
Output is correct |
28 |
Correct |
7 ms |
15704 KB |
Output is correct |
29 |
Correct |
10 ms |
15960 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
1112 KB |
Output is correct |
2 |
Correct |
1 ms |
3160 KB |
Output is correct |
3 |
Correct |
1 ms |
5208 KB |
Output is correct |
4 |
Correct |
1 ms |
3160 KB |
Output is correct |
5 |
Correct |
1 ms |
5208 KB |
Output is correct |
6 |
Correct |
1 ms |
5208 KB |
Output is correct |
7 |
Correct |
1 ms |
5208 KB |
Output is correct |
8 |
Correct |
1 ms |
1112 KB |
Output is correct |
9 |
Correct |
0 ms |
1112 KB |
Output is correct |
10 |
Correct |
1 ms |
1112 KB |
Output is correct |
11 |
Correct |
1 ms |
3160 KB |
Output is correct |
12 |
Correct |
1 ms |
3156 KB |
Output is correct |
13 |
Correct |
1 ms |
3160 KB |
Output is correct |
14 |
Correct |
1 ms |
3160 KB |
Output is correct |
15 |
Correct |
1 ms |
3160 KB |
Output is correct |
16 |
Correct |
1 ms |
3160 KB |
Output is correct |
17 |
Correct |
1 ms |
3160 KB |
Output is correct |
18 |
Correct |
1 ms |
3160 KB |
Output is correct |
19 |
Correct |
1 ms |
3160 KB |
Output is correct |
20 |
Correct |
1 ms |
3160 KB |
Output is correct |
21 |
Correct |
1 ms |
5208 KB |
Output is correct |
22 |
Correct |
2 ms |
5208 KB |
Output is correct |
23 |
Correct |
1 ms |
3160 KB |
Output is correct |
24 |
Correct |
10 ms |
17496 KB |
Output is correct |
25 |
Correct |
7 ms |
9816 KB |
Output is correct |
26 |
Correct |
5 ms |
5812 KB |
Output is correct |
27 |
Correct |
14 ms |
17912 KB |
Output is correct |
28 |
Correct |
7 ms |
15704 KB |
Output is correct |
29 |
Correct |
10 ms |
15960 KB |
Output is correct |
30 |
Correct |
21 ms |
6972 KB |
Output is correct |
31 |
Correct |
66 ms |
30248 KB |
Output is correct |
32 |
Correct |
30 ms |
6744 KB |
Output is correct |
33 |
Correct |
16 ms |
5104 KB |
Output is correct |
34 |
Correct |
717 ms |
32880 KB |
Output is correct |
35 |
Correct |
1046 ms |
31772 KB |
Output is correct |
36 |
Correct |
84 ms |
6800 KB |
Output is correct |
37 |
Correct |
1265 ms |
31760 KB |
Output is correct |
38 |
Correct |
1421 ms |
31756 KB |
Output is correct |
39 |
Correct |
1602 ms |
31648 KB |
Output is correct |
40 |
Correct |
2964 ms |
33028 KB |
Output is correct |
41 |
Correct |
1388 ms |
32072 KB |
Output is correct |
42 |
Correct |
957 ms |
31912 KB |
Output is correct |
43 |
Correct |
2462 ms |
32772 KB |
Output is correct |
44 |
Correct |
847 ms |
32404 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
1112 KB |
Output is correct |
2 |
Correct |
1 ms |
3160 KB |
Output is correct |
3 |
Correct |
1 ms |
5208 KB |
Output is correct |
4 |
Correct |
1 ms |
3160 KB |
Output is correct |
5 |
Correct |
1 ms |
5208 KB |
Output is correct |
6 |
Correct |
1 ms |
5208 KB |
Output is correct |
7 |
Correct |
1 ms |
5208 KB |
Output is correct |
8 |
Correct |
1 ms |
1112 KB |
Output is correct |
9 |
Correct |
0 ms |
1112 KB |
Output is correct |
10 |
Correct |
1 ms |
1112 KB |
Output is correct |
11 |
Correct |
1 ms |
3160 KB |
Output is correct |
12 |
Correct |
1 ms |
3156 KB |
Output is correct |
13 |
Correct |
1 ms |
3160 KB |
Output is correct |
14 |
Correct |
1 ms |
3160 KB |
Output is correct |
15 |
Correct |
1 ms |
3160 KB |
Output is correct |
16 |
Correct |
1 ms |
3160 KB |
Output is correct |
17 |
Correct |
1 ms |
3160 KB |
Output is correct |
18 |
Correct |
1 ms |
3160 KB |
Output is correct |
19 |
Correct |
1 ms |
3160 KB |
Output is correct |
20 |
Correct |
1 ms |
3160 KB |
Output is correct |
21 |
Correct |
1 ms |
5208 KB |
Output is correct |
22 |
Correct |
2 ms |
5208 KB |
Output is correct |
23 |
Correct |
1 ms |
3160 KB |
Output is correct |
24 |
Correct |
10 ms |
17496 KB |
Output is correct |
25 |
Correct |
7 ms |
9816 KB |
Output is correct |
26 |
Correct |
5 ms |
5812 KB |
Output is correct |
27 |
Correct |
14 ms |
17912 KB |
Output is correct |
28 |
Correct |
7 ms |
15704 KB |
Output is correct |
29 |
Correct |
10 ms |
15960 KB |
Output is correct |
30 |
Correct |
21 ms |
6972 KB |
Output is correct |
31 |
Correct |
66 ms |
30248 KB |
Output is correct |
32 |
Correct |
30 ms |
6744 KB |
Output is correct |
33 |
Correct |
16 ms |
5104 KB |
Output is correct |
34 |
Correct |
717 ms |
32880 KB |
Output is correct |
35 |
Correct |
1046 ms |
31772 KB |
Output is correct |
36 |
Correct |
84 ms |
6800 KB |
Output is correct |
37 |
Correct |
1265 ms |
31760 KB |
Output is correct |
38 |
Correct |
1421 ms |
31756 KB |
Output is correct |
39 |
Correct |
1602 ms |
31648 KB |
Output is correct |
40 |
Correct |
2964 ms |
33028 KB |
Output is correct |
41 |
Correct |
1388 ms |
32072 KB |
Output is correct |
42 |
Correct |
957 ms |
31912 KB |
Output is correct |
43 |
Correct |
2462 ms |
32772 KB |
Output is correct |
44 |
Correct |
847 ms |
32404 KB |
Output is correct |
45 |
Runtime error |
5 ms |
10332 KB |
Execution killed with signal 11 |
46 |
Halted |
0 ms |
0 KB |
- |