#include "game.h"
#include<bits/stdc++.h>
using namespace std;
int n , k;
vector<vector<bool>> vis;
vector<vector<int>> adj;
bool acc = 0;
void dfs(int x , int i)
{
if(vis[i][x])
{
if(x <= i)
acc = 1;
return ;
}
if(x <= i)
acc = 1;
vis[i][x] = 1;
for(auto u : adj[x])
{
dfs(u , i);
}
}
void init(int N, int K) {
n = N , k = K;
adj.assign(n , {});
vis.assign(k , vector<bool>(n));
for(int i = 0 ;i < k ; i++)
{
vis[i][i] = 1;
}
}
int add_teleporter(int u, int v) {
adj[u].push_back(v);
for(int i = 0 ; i < k ; i++)
{
if(vis[i][u])
{
dfs(v , i);
}
}
return acc;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
340 KB |
Output is correct |
2 |
Correct |
0 ms |
344 KB |
Output is correct |
3 |
Correct |
0 ms |
344 KB |
Output is correct |
4 |
Correct |
1 ms |
344 KB |
Output is correct |
5 |
Correct |
1 ms |
344 KB |
Output is correct |
6 |
Correct |
1 ms |
344 KB |
Output is correct |
7 |
Correct |
0 ms |
344 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
340 KB |
Output is correct |
2 |
Correct |
0 ms |
344 KB |
Output is correct |
3 |
Correct |
0 ms |
344 KB |
Output is correct |
4 |
Correct |
1 ms |
344 KB |
Output is correct |
5 |
Correct |
1 ms |
344 KB |
Output is correct |
6 |
Correct |
1 ms |
344 KB |
Output is correct |
7 |
Correct |
0 ms |
344 KB |
Output is correct |
8 |
Correct |
0 ms |
344 KB |
Output is correct |
9 |
Correct |
0 ms |
344 KB |
Output is correct |
10 |
Correct |
0 ms |
344 KB |
Output is correct |
11 |
Correct |
0 ms |
344 KB |
Output is correct |
12 |
Correct |
0 ms |
344 KB |
Output is correct |
13 |
Correct |
0 ms |
344 KB |
Output is correct |
14 |
Correct |
1 ms |
344 KB |
Output is correct |
15 |
Correct |
0 ms |
344 KB |
Output is correct |
16 |
Correct |
1 ms |
344 KB |
Output is correct |
17 |
Correct |
1 ms |
344 KB |
Output is correct |
18 |
Correct |
0 ms |
344 KB |
Output is correct |
19 |
Correct |
0 ms |
344 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
340 KB |
Output is correct |
2 |
Correct |
0 ms |
344 KB |
Output is correct |
3 |
Correct |
0 ms |
344 KB |
Output is correct |
4 |
Correct |
1 ms |
344 KB |
Output is correct |
5 |
Correct |
1 ms |
344 KB |
Output is correct |
6 |
Correct |
1 ms |
344 KB |
Output is correct |
7 |
Correct |
0 ms |
344 KB |
Output is correct |
8 |
Correct |
0 ms |
344 KB |
Output is correct |
9 |
Correct |
0 ms |
344 KB |
Output is correct |
10 |
Correct |
0 ms |
344 KB |
Output is correct |
11 |
Correct |
0 ms |
344 KB |
Output is correct |
12 |
Correct |
0 ms |
344 KB |
Output is correct |
13 |
Correct |
0 ms |
344 KB |
Output is correct |
14 |
Correct |
1 ms |
344 KB |
Output is correct |
15 |
Correct |
0 ms |
344 KB |
Output is correct |
16 |
Correct |
1 ms |
344 KB |
Output is correct |
17 |
Correct |
1 ms |
344 KB |
Output is correct |
18 |
Correct |
0 ms |
344 KB |
Output is correct |
19 |
Correct |
0 ms |
344 KB |
Output is correct |
20 |
Correct |
1 ms |
344 KB |
Output is correct |
21 |
Correct |
0 ms |
344 KB |
Output is correct |
22 |
Correct |
1 ms |
428 KB |
Output is correct |
23 |
Correct |
1 ms |
344 KB |
Output is correct |
24 |
Correct |
2 ms |
420 KB |
Output is correct |
25 |
Correct |
3 ms |
344 KB |
Output is correct |
26 |
Correct |
3 ms |
344 KB |
Output is correct |
27 |
Correct |
6 ms |
572 KB |
Output is correct |
28 |
Correct |
4 ms |
344 KB |
Output is correct |
29 |
Correct |
6 ms |
344 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
340 KB |
Output is correct |
2 |
Correct |
0 ms |
344 KB |
Output is correct |
3 |
Correct |
0 ms |
344 KB |
Output is correct |
4 |
Correct |
1 ms |
344 KB |
Output is correct |
5 |
Correct |
1 ms |
344 KB |
Output is correct |
6 |
Correct |
1 ms |
344 KB |
Output is correct |
7 |
Correct |
0 ms |
344 KB |
Output is correct |
8 |
Correct |
0 ms |
344 KB |
Output is correct |
9 |
Correct |
0 ms |
344 KB |
Output is correct |
10 |
Correct |
0 ms |
344 KB |
Output is correct |
11 |
Correct |
0 ms |
344 KB |
Output is correct |
12 |
Correct |
0 ms |
344 KB |
Output is correct |
13 |
Correct |
0 ms |
344 KB |
Output is correct |
14 |
Correct |
1 ms |
344 KB |
Output is correct |
15 |
Correct |
0 ms |
344 KB |
Output is correct |
16 |
Correct |
1 ms |
344 KB |
Output is correct |
17 |
Correct |
1 ms |
344 KB |
Output is correct |
18 |
Correct |
0 ms |
344 KB |
Output is correct |
19 |
Correct |
0 ms |
344 KB |
Output is correct |
20 |
Correct |
1 ms |
344 KB |
Output is correct |
21 |
Correct |
0 ms |
344 KB |
Output is correct |
22 |
Correct |
1 ms |
428 KB |
Output is correct |
23 |
Correct |
1 ms |
344 KB |
Output is correct |
24 |
Correct |
2 ms |
420 KB |
Output is correct |
25 |
Correct |
3 ms |
344 KB |
Output is correct |
26 |
Correct |
3 ms |
344 KB |
Output is correct |
27 |
Correct |
6 ms |
572 KB |
Output is correct |
28 |
Correct |
4 ms |
344 KB |
Output is correct |
29 |
Correct |
6 ms |
344 KB |
Output is correct |
30 |
Correct |
16 ms |
2136 KB |
Output is correct |
31 |
Correct |
15 ms |
4952 KB |
Output is correct |
32 |
Correct |
13 ms |
2472 KB |
Output is correct |
33 |
Correct |
13 ms |
2128 KB |
Output is correct |
34 |
Correct |
566 ms |
6592 KB |
Output is correct |
35 |
Correct |
402 ms |
6328 KB |
Output is correct |
36 |
Correct |
59 ms |
2516 KB |
Output is correct |
37 |
Correct |
304 ms |
5712 KB |
Output is correct |
38 |
Correct |
200 ms |
5284 KB |
Output is correct |
39 |
Correct |
281 ms |
5508 KB |
Output is correct |
40 |
Correct |
490 ms |
6804 KB |
Output is correct |
41 |
Correct |
202 ms |
5968 KB |
Output is correct |
42 |
Correct |
157 ms |
5728 KB |
Output is correct |
43 |
Correct |
833 ms |
6512 KB |
Output is correct |
44 |
Correct |
354 ms |
6500 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
340 KB |
Output is correct |
2 |
Correct |
0 ms |
344 KB |
Output is correct |
3 |
Correct |
0 ms |
344 KB |
Output is correct |
4 |
Correct |
1 ms |
344 KB |
Output is correct |
5 |
Correct |
1 ms |
344 KB |
Output is correct |
6 |
Correct |
1 ms |
344 KB |
Output is correct |
7 |
Correct |
0 ms |
344 KB |
Output is correct |
8 |
Correct |
0 ms |
344 KB |
Output is correct |
9 |
Correct |
0 ms |
344 KB |
Output is correct |
10 |
Correct |
0 ms |
344 KB |
Output is correct |
11 |
Correct |
0 ms |
344 KB |
Output is correct |
12 |
Correct |
0 ms |
344 KB |
Output is correct |
13 |
Correct |
0 ms |
344 KB |
Output is correct |
14 |
Correct |
1 ms |
344 KB |
Output is correct |
15 |
Correct |
0 ms |
344 KB |
Output is correct |
16 |
Correct |
1 ms |
344 KB |
Output is correct |
17 |
Correct |
1 ms |
344 KB |
Output is correct |
18 |
Correct |
0 ms |
344 KB |
Output is correct |
19 |
Correct |
0 ms |
344 KB |
Output is correct |
20 |
Correct |
1 ms |
344 KB |
Output is correct |
21 |
Correct |
0 ms |
344 KB |
Output is correct |
22 |
Correct |
1 ms |
428 KB |
Output is correct |
23 |
Correct |
1 ms |
344 KB |
Output is correct |
24 |
Correct |
2 ms |
420 KB |
Output is correct |
25 |
Correct |
3 ms |
344 KB |
Output is correct |
26 |
Correct |
3 ms |
344 KB |
Output is correct |
27 |
Correct |
6 ms |
572 KB |
Output is correct |
28 |
Correct |
4 ms |
344 KB |
Output is correct |
29 |
Correct |
6 ms |
344 KB |
Output is correct |
30 |
Correct |
16 ms |
2136 KB |
Output is correct |
31 |
Correct |
15 ms |
4952 KB |
Output is correct |
32 |
Correct |
13 ms |
2472 KB |
Output is correct |
33 |
Correct |
13 ms |
2128 KB |
Output is correct |
34 |
Correct |
566 ms |
6592 KB |
Output is correct |
35 |
Correct |
402 ms |
6328 KB |
Output is correct |
36 |
Correct |
59 ms |
2516 KB |
Output is correct |
37 |
Correct |
304 ms |
5712 KB |
Output is correct |
38 |
Correct |
200 ms |
5284 KB |
Output is correct |
39 |
Correct |
281 ms |
5508 KB |
Output is correct |
40 |
Correct |
490 ms |
6804 KB |
Output is correct |
41 |
Correct |
202 ms |
5968 KB |
Output is correct |
42 |
Correct |
157 ms |
5728 KB |
Output is correct |
43 |
Correct |
833 ms |
6512 KB |
Output is correct |
44 |
Correct |
354 ms |
6500 KB |
Output is correct |
45 |
Correct |
167 ms |
17108 KB |
Output is correct |
46 |
Correct |
70 ms |
44368 KB |
Output is correct |
47 |
Correct |
134 ms |
81148 KB |
Output is correct |
48 |
Correct |
180 ms |
24324 KB |
Output is correct |
49 |
Correct |
200 ms |
20556 KB |
Output is correct |
50 |
Runtime error |
104 ms |
262144 KB |
Execution killed with signal 9 |
51 |
Halted |
0 ms |
0 KB |
- |