#include "game.h"
#include <bits/stdc++.h>
using namespace std;
const int N = 1000 + 5;
int n, k;
bool f[N][N];
void init(int N, int K){
n = N; k = K;
for(int i = 0; i < k - 1; ++i){
f[i][i + 1] = true;
}
}
int add_teleporter(int u, int v){
f[u][v] = true;
if (u >= v && u < k) return 1;
for(int i = 0; i < n; ++i){
if (f[i][u]){
//i -> u -> v
f[i][v] = true;
if (i >= v && i < k) return 1;
}
if (f[v][i]){
f[u][i] = true;
//u -> v -> i
if (u >= i && u < k) return 1;
}
}
for(int i = 0; i < n; ++i){
if (!f[i][u]) continue;
//i -> u
for(int j = 0; j < n; ++j){
if (!f[v][j]) continue;
//v -> j
//i -> u -> v -> j;
f[i][j] = true;
if (i >= j && i < k) return 1;
}
}
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
208 KB |
Output is correct |
2 |
Correct |
1 ms |
208 KB |
Output is correct |
3 |
Correct |
1 ms |
336 KB |
Output is correct |
4 |
Correct |
0 ms |
336 KB |
Output is correct |
5 |
Correct |
1 ms |
336 KB |
Output is correct |
6 |
Correct |
1 ms |
336 KB |
Output is correct |
7 |
Correct |
1 ms |
336 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
208 KB |
Output is correct |
2 |
Correct |
1 ms |
208 KB |
Output is correct |
3 |
Correct |
1 ms |
336 KB |
Output is correct |
4 |
Correct |
0 ms |
336 KB |
Output is correct |
5 |
Correct |
1 ms |
336 KB |
Output is correct |
6 |
Correct |
1 ms |
336 KB |
Output is correct |
7 |
Correct |
1 ms |
336 KB |
Output is correct |
8 |
Correct |
0 ms |
220 KB |
Output is correct |
9 |
Correct |
1 ms |
208 KB |
Output is correct |
10 |
Correct |
0 ms |
208 KB |
Output is correct |
11 |
Correct |
1 ms |
336 KB |
Output is correct |
12 |
Correct |
0 ms |
336 KB |
Output is correct |
13 |
Correct |
0 ms |
336 KB |
Output is correct |
14 |
Correct |
1 ms |
336 KB |
Output is correct |
15 |
Correct |
1 ms |
336 KB |
Output is correct |
16 |
Correct |
1 ms |
336 KB |
Output is correct |
17 |
Correct |
1 ms |
336 KB |
Output is correct |
18 |
Correct |
1 ms |
336 KB |
Output is correct |
19 |
Correct |
1 ms |
336 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
208 KB |
Output is correct |
2 |
Correct |
1 ms |
208 KB |
Output is correct |
3 |
Correct |
1 ms |
336 KB |
Output is correct |
4 |
Correct |
0 ms |
336 KB |
Output is correct |
5 |
Correct |
1 ms |
336 KB |
Output is correct |
6 |
Correct |
1 ms |
336 KB |
Output is correct |
7 |
Correct |
1 ms |
336 KB |
Output is correct |
8 |
Correct |
0 ms |
220 KB |
Output is correct |
9 |
Correct |
1 ms |
208 KB |
Output is correct |
10 |
Correct |
0 ms |
208 KB |
Output is correct |
11 |
Correct |
1 ms |
336 KB |
Output is correct |
12 |
Correct |
0 ms |
336 KB |
Output is correct |
13 |
Correct |
0 ms |
336 KB |
Output is correct |
14 |
Correct |
1 ms |
336 KB |
Output is correct |
15 |
Correct |
1 ms |
336 KB |
Output is correct |
16 |
Correct |
1 ms |
336 KB |
Output is correct |
17 |
Correct |
1 ms |
336 KB |
Output is correct |
18 |
Correct |
1 ms |
336 KB |
Output is correct |
19 |
Correct |
1 ms |
336 KB |
Output is correct |
20 |
Correct |
5 ms |
1232 KB |
Output is correct |
21 |
Correct |
2 ms |
720 KB |
Output is correct |
22 |
Correct |
6 ms |
1200 KB |
Output is correct |
23 |
Correct |
5 ms |
1232 KB |
Output is correct |
24 |
Correct |
76 ms |
1232 KB |
Output is correct |
25 |
Correct |
316 ms |
1232 KB |
Output is correct |
26 |
Correct |
478 ms |
1232 KB |
Output is correct |
27 |
Correct |
50 ms |
1232 KB |
Output is correct |
28 |
Correct |
28 ms |
1160 KB |
Output is correct |
29 |
Correct |
87 ms |
1272 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
208 KB |
Output is correct |
2 |
Correct |
1 ms |
208 KB |
Output is correct |
3 |
Correct |
1 ms |
336 KB |
Output is correct |
4 |
Correct |
0 ms |
336 KB |
Output is correct |
5 |
Correct |
1 ms |
336 KB |
Output is correct |
6 |
Correct |
1 ms |
336 KB |
Output is correct |
7 |
Correct |
1 ms |
336 KB |
Output is correct |
8 |
Correct |
0 ms |
220 KB |
Output is correct |
9 |
Correct |
1 ms |
208 KB |
Output is correct |
10 |
Correct |
0 ms |
208 KB |
Output is correct |
11 |
Correct |
1 ms |
336 KB |
Output is correct |
12 |
Correct |
0 ms |
336 KB |
Output is correct |
13 |
Correct |
0 ms |
336 KB |
Output is correct |
14 |
Correct |
1 ms |
336 KB |
Output is correct |
15 |
Correct |
1 ms |
336 KB |
Output is correct |
16 |
Correct |
1 ms |
336 KB |
Output is correct |
17 |
Correct |
1 ms |
336 KB |
Output is correct |
18 |
Correct |
1 ms |
336 KB |
Output is correct |
19 |
Correct |
1 ms |
336 KB |
Output is correct |
20 |
Correct |
5 ms |
1232 KB |
Output is correct |
21 |
Correct |
2 ms |
720 KB |
Output is correct |
22 |
Correct |
6 ms |
1200 KB |
Output is correct |
23 |
Correct |
5 ms |
1232 KB |
Output is correct |
24 |
Correct |
76 ms |
1232 KB |
Output is correct |
25 |
Correct |
316 ms |
1232 KB |
Output is correct |
26 |
Correct |
478 ms |
1232 KB |
Output is correct |
27 |
Correct |
50 ms |
1232 KB |
Output is correct |
28 |
Correct |
28 ms |
1160 KB |
Output is correct |
29 |
Correct |
87 ms |
1272 KB |
Output is correct |
30 |
Runtime error |
1 ms |
592 KB |
Execution killed with signal 11 |
31 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
208 KB |
Output is correct |
2 |
Correct |
1 ms |
208 KB |
Output is correct |
3 |
Correct |
1 ms |
336 KB |
Output is correct |
4 |
Correct |
0 ms |
336 KB |
Output is correct |
5 |
Correct |
1 ms |
336 KB |
Output is correct |
6 |
Correct |
1 ms |
336 KB |
Output is correct |
7 |
Correct |
1 ms |
336 KB |
Output is correct |
8 |
Correct |
0 ms |
220 KB |
Output is correct |
9 |
Correct |
1 ms |
208 KB |
Output is correct |
10 |
Correct |
0 ms |
208 KB |
Output is correct |
11 |
Correct |
1 ms |
336 KB |
Output is correct |
12 |
Correct |
0 ms |
336 KB |
Output is correct |
13 |
Correct |
0 ms |
336 KB |
Output is correct |
14 |
Correct |
1 ms |
336 KB |
Output is correct |
15 |
Correct |
1 ms |
336 KB |
Output is correct |
16 |
Correct |
1 ms |
336 KB |
Output is correct |
17 |
Correct |
1 ms |
336 KB |
Output is correct |
18 |
Correct |
1 ms |
336 KB |
Output is correct |
19 |
Correct |
1 ms |
336 KB |
Output is correct |
20 |
Correct |
5 ms |
1232 KB |
Output is correct |
21 |
Correct |
2 ms |
720 KB |
Output is correct |
22 |
Correct |
6 ms |
1200 KB |
Output is correct |
23 |
Correct |
5 ms |
1232 KB |
Output is correct |
24 |
Correct |
76 ms |
1232 KB |
Output is correct |
25 |
Correct |
316 ms |
1232 KB |
Output is correct |
26 |
Correct |
478 ms |
1232 KB |
Output is correct |
27 |
Correct |
50 ms |
1232 KB |
Output is correct |
28 |
Correct |
28 ms |
1160 KB |
Output is correct |
29 |
Correct |
87 ms |
1272 KB |
Output is correct |
30 |
Runtime error |
1 ms |
592 KB |
Execution killed with signal 11 |
31 |
Halted |
0 ms |
0 KB |
- |