#include "game.h"
#include<bits/stdc++.h>
using namespace std;
int vt[300003],N,K;
vector<int>ad[300003];
bool dfs(int u,int vl=-1){
vt[u]=1;
if(u<K)vl=u;
for(auto v:ad[u]){
if(v<=vl)return 1;
if(!vt[v])
if(dfs(v,vl))return 1;
}
return 0;
}
void init(int n, int k) {
N=n,K=k;
for(int i=0;i<k-1;i++)
ad[i].push_back(i+1);
}
int add_teleporter(int u, int v){
ad[u].push_back(v);
for(int i=0;i<N;i++)vt[i]=0;
return dfs(0);
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
7256 KB |
Output is correct |
2 |
Correct |
2 ms |
7256 KB |
Output is correct |
3 |
Correct |
2 ms |
7256 KB |
Output is correct |
4 |
Correct |
2 ms |
7256 KB |
Output is correct |
5 |
Correct |
3 ms |
7256 KB |
Output is correct |
6 |
Correct |
4 ms |
7256 KB |
Output is correct |
7 |
Correct |
2 ms |
7256 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
7256 KB |
Output is correct |
2 |
Correct |
2 ms |
7256 KB |
Output is correct |
3 |
Correct |
2 ms |
7256 KB |
Output is correct |
4 |
Correct |
2 ms |
7256 KB |
Output is correct |
5 |
Correct |
3 ms |
7256 KB |
Output is correct |
6 |
Correct |
4 ms |
7256 KB |
Output is correct |
7 |
Correct |
2 ms |
7256 KB |
Output is correct |
8 |
Correct |
2 ms |
7256 KB |
Output is correct |
9 |
Correct |
2 ms |
7256 KB |
Output is correct |
10 |
Correct |
2 ms |
7256 KB |
Output is correct |
11 |
Correct |
2 ms |
7256 KB |
Output is correct |
12 |
Correct |
2 ms |
7256 KB |
Output is correct |
13 |
Correct |
3 ms |
7256 KB |
Output is correct |
14 |
Correct |
2 ms |
7256 KB |
Output is correct |
15 |
Correct |
2 ms |
7256 KB |
Output is correct |
16 |
Correct |
2 ms |
7256 KB |
Output is correct |
17 |
Correct |
2 ms |
7256 KB |
Output is correct |
18 |
Correct |
2 ms |
7256 KB |
Output is correct |
19 |
Correct |
3 ms |
7256 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
7256 KB |
Output is correct |
2 |
Correct |
2 ms |
7256 KB |
Output is correct |
3 |
Correct |
2 ms |
7256 KB |
Output is correct |
4 |
Correct |
2 ms |
7256 KB |
Output is correct |
5 |
Correct |
3 ms |
7256 KB |
Output is correct |
6 |
Correct |
4 ms |
7256 KB |
Output is correct |
7 |
Correct |
2 ms |
7256 KB |
Output is correct |
8 |
Correct |
2 ms |
7256 KB |
Output is correct |
9 |
Correct |
2 ms |
7256 KB |
Output is correct |
10 |
Correct |
2 ms |
7256 KB |
Output is correct |
11 |
Correct |
2 ms |
7256 KB |
Output is correct |
12 |
Correct |
2 ms |
7256 KB |
Output is correct |
13 |
Correct |
3 ms |
7256 KB |
Output is correct |
14 |
Correct |
2 ms |
7256 KB |
Output is correct |
15 |
Correct |
2 ms |
7256 KB |
Output is correct |
16 |
Correct |
2 ms |
7256 KB |
Output is correct |
17 |
Correct |
2 ms |
7256 KB |
Output is correct |
18 |
Correct |
2 ms |
7256 KB |
Output is correct |
19 |
Correct |
3 ms |
7256 KB |
Output is correct |
20 |
Correct |
2 ms |
7252 KB |
Output is correct |
21 |
Correct |
2 ms |
7256 KB |
Output is correct |
22 |
Correct |
3 ms |
7512 KB |
Output is correct |
23 |
Correct |
3 ms |
7512 KB |
Output is correct |
24 |
Correct |
8 ms |
7512 KB |
Output is correct |
25 |
Correct |
22 ms |
7768 KB |
Output is correct |
26 |
Correct |
27 ms |
7544 KB |
Output is correct |
27 |
Correct |
32 ms |
7508 KB |
Output is correct |
28 |
Correct |
13 ms |
7512 KB |
Output is correct |
29 |
Correct |
25 ms |
7768 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
7256 KB |
Output is correct |
2 |
Correct |
2 ms |
7256 KB |
Output is correct |
3 |
Correct |
2 ms |
7256 KB |
Output is correct |
4 |
Correct |
2 ms |
7256 KB |
Output is correct |
5 |
Correct |
3 ms |
7256 KB |
Output is correct |
6 |
Correct |
4 ms |
7256 KB |
Output is correct |
7 |
Correct |
2 ms |
7256 KB |
Output is correct |
8 |
Correct |
2 ms |
7256 KB |
Output is correct |
9 |
Correct |
2 ms |
7256 KB |
Output is correct |
10 |
Correct |
2 ms |
7256 KB |
Output is correct |
11 |
Correct |
2 ms |
7256 KB |
Output is correct |
12 |
Correct |
2 ms |
7256 KB |
Output is correct |
13 |
Correct |
3 ms |
7256 KB |
Output is correct |
14 |
Correct |
2 ms |
7256 KB |
Output is correct |
15 |
Correct |
2 ms |
7256 KB |
Output is correct |
16 |
Correct |
2 ms |
7256 KB |
Output is correct |
17 |
Correct |
2 ms |
7256 KB |
Output is correct |
18 |
Correct |
2 ms |
7256 KB |
Output is correct |
19 |
Correct |
3 ms |
7256 KB |
Output is correct |
20 |
Correct |
2 ms |
7252 KB |
Output is correct |
21 |
Correct |
2 ms |
7256 KB |
Output is correct |
22 |
Correct |
3 ms |
7512 KB |
Output is correct |
23 |
Correct |
3 ms |
7512 KB |
Output is correct |
24 |
Correct |
8 ms |
7512 KB |
Output is correct |
25 |
Correct |
22 ms |
7768 KB |
Output is correct |
26 |
Correct |
27 ms |
7544 KB |
Output is correct |
27 |
Correct |
32 ms |
7508 KB |
Output is correct |
28 |
Correct |
13 ms |
7512 KB |
Output is correct |
29 |
Correct |
25 ms |
7768 KB |
Output is correct |
30 |
Correct |
114 ms |
8272 KB |
Output is correct |
31 |
Correct |
68 ms |
8068 KB |
Output is correct |
32 |
Correct |
80 ms |
9872 KB |
Output is correct |
33 |
Correct |
57 ms |
8744 KB |
Output is correct |
34 |
Correct |
1056 ms |
10224 KB |
Output is correct |
35 |
Execution timed out |
4032 ms |
9100 KB |
Time limit exceeded |
36 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
7256 KB |
Output is correct |
2 |
Correct |
2 ms |
7256 KB |
Output is correct |
3 |
Correct |
2 ms |
7256 KB |
Output is correct |
4 |
Correct |
2 ms |
7256 KB |
Output is correct |
5 |
Correct |
3 ms |
7256 KB |
Output is correct |
6 |
Correct |
4 ms |
7256 KB |
Output is correct |
7 |
Correct |
2 ms |
7256 KB |
Output is correct |
8 |
Correct |
2 ms |
7256 KB |
Output is correct |
9 |
Correct |
2 ms |
7256 KB |
Output is correct |
10 |
Correct |
2 ms |
7256 KB |
Output is correct |
11 |
Correct |
2 ms |
7256 KB |
Output is correct |
12 |
Correct |
2 ms |
7256 KB |
Output is correct |
13 |
Correct |
3 ms |
7256 KB |
Output is correct |
14 |
Correct |
2 ms |
7256 KB |
Output is correct |
15 |
Correct |
2 ms |
7256 KB |
Output is correct |
16 |
Correct |
2 ms |
7256 KB |
Output is correct |
17 |
Correct |
2 ms |
7256 KB |
Output is correct |
18 |
Correct |
2 ms |
7256 KB |
Output is correct |
19 |
Correct |
3 ms |
7256 KB |
Output is correct |
20 |
Correct |
2 ms |
7252 KB |
Output is correct |
21 |
Correct |
2 ms |
7256 KB |
Output is correct |
22 |
Correct |
3 ms |
7512 KB |
Output is correct |
23 |
Correct |
3 ms |
7512 KB |
Output is correct |
24 |
Correct |
8 ms |
7512 KB |
Output is correct |
25 |
Correct |
22 ms |
7768 KB |
Output is correct |
26 |
Correct |
27 ms |
7544 KB |
Output is correct |
27 |
Correct |
32 ms |
7508 KB |
Output is correct |
28 |
Correct |
13 ms |
7512 KB |
Output is correct |
29 |
Correct |
25 ms |
7768 KB |
Output is correct |
30 |
Correct |
114 ms |
8272 KB |
Output is correct |
31 |
Correct |
68 ms |
8068 KB |
Output is correct |
32 |
Correct |
80 ms |
9872 KB |
Output is correct |
33 |
Correct |
57 ms |
8744 KB |
Output is correct |
34 |
Correct |
1056 ms |
10224 KB |
Output is correct |
35 |
Execution timed out |
4032 ms |
9100 KB |
Time limit exceeded |
36 |
Halted |
0 ms |
0 KB |
- |