#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]=vl;
for(auto v:ad[u]){
if(v<=vl)return 1;
if(vt[v]<vl)
if(dfs(v,vl))return 1;
}
return 0;
}
void init(int n, int k) {
N=n,K=k,vt[k-1]=k-1;
for(int i=0;i<k-1;i++)
vt[i]=i,ad[i].push_back(i+1);
for(int i=k;i<n;i++)vt[i]=-1;
}
int add_teleporter(int u, int v){
ad[u].push_back(v);
int vl=vt[u];
if(v<=vl)return 1;
if(vt[v]<vl)return dfs(v,vt[u]);
return 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 |
2 ms |
7256 KB |
Output is correct |
6 |
Correct |
2 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 |
2 ms |
7256 KB |
Output is correct |
6 |
Correct |
2 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 |
7252 KB |
Output is correct |
10 |
Correct |
2 ms |
7260 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 |
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 |
2 ms |
7256 KB |
Output is correct |
6 |
Correct |
2 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 |
7252 KB |
Output is correct |
10 |
Correct |
2 ms |
7260 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 |
2 ms |
7256 KB |
Output is correct |
20 |
Correct |
2 ms |
7512 KB |
Output is correct |
21 |
Correct |
2 ms |
7256 KB |
Output is correct |
22 |
Correct |
2 ms |
7512 KB |
Output is correct |
23 |
Correct |
2 ms |
7512 KB |
Output is correct |
24 |
Correct |
3 ms |
7764 KB |
Output is correct |
25 |
Correct |
4 ms |
7756 KB |
Output is correct |
26 |
Correct |
4 ms |
7512 KB |
Output is correct |
27 |
Correct |
4 ms |
7512 KB |
Output is correct |
28 |
Correct |
3 ms |
7512 KB |
Output is correct |
29 |
Correct |
4 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 |
2 ms |
7256 KB |
Output is correct |
6 |
Correct |
2 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 |
7252 KB |
Output is correct |
10 |
Correct |
2 ms |
7260 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 |
2 ms |
7256 KB |
Output is correct |
20 |
Correct |
2 ms |
7512 KB |
Output is correct |
21 |
Correct |
2 ms |
7256 KB |
Output is correct |
22 |
Correct |
2 ms |
7512 KB |
Output is correct |
23 |
Correct |
2 ms |
7512 KB |
Output is correct |
24 |
Correct |
3 ms |
7764 KB |
Output is correct |
25 |
Correct |
4 ms |
7756 KB |
Output is correct |
26 |
Correct |
4 ms |
7512 KB |
Output is correct |
27 |
Correct |
4 ms |
7512 KB |
Output is correct |
28 |
Correct |
3 ms |
7512 KB |
Output is correct |
29 |
Correct |
4 ms |
7768 KB |
Output is correct |
30 |
Correct |
12 ms |
8956 KB |
Output is correct |
31 |
Correct |
4 ms |
7964 KB |
Output is correct |
32 |
Correct |
17 ms |
8924 KB |
Output is correct |
33 |
Correct |
14 ms |
9188 KB |
Output is correct |
34 |
Correct |
444 ms |
9876 KB |
Output is correct |
35 |
Correct |
157 ms |
9168 KB |
Output is correct |
36 |
Correct |
26 ms |
9324 KB |
Output is correct |
37 |
Correct |
24 ms |
9072 KB |
Output is correct |
38 |
Correct |
19 ms |
8536 KB |
Output is correct |
39 |
Correct |
20 ms |
9476 KB |
Output is correct |
40 |
Correct |
355 ms |
10008 KB |
Output is correct |
41 |
Correct |
81 ms |
9308 KB |
Output is correct |
42 |
Correct |
51 ms |
8692 KB |
Output is correct |
43 |
Correct |
21 ms |
9852 KB |
Output is correct |
44 |
Correct |
238 ms |
10316 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 |
2 ms |
7256 KB |
Output is correct |
6 |
Correct |
2 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 |
7252 KB |
Output is correct |
10 |
Correct |
2 ms |
7260 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 |
2 ms |
7256 KB |
Output is correct |
20 |
Correct |
2 ms |
7512 KB |
Output is correct |
21 |
Correct |
2 ms |
7256 KB |
Output is correct |
22 |
Correct |
2 ms |
7512 KB |
Output is correct |
23 |
Correct |
2 ms |
7512 KB |
Output is correct |
24 |
Correct |
3 ms |
7764 KB |
Output is correct |
25 |
Correct |
4 ms |
7756 KB |
Output is correct |
26 |
Correct |
4 ms |
7512 KB |
Output is correct |
27 |
Correct |
4 ms |
7512 KB |
Output is correct |
28 |
Correct |
3 ms |
7512 KB |
Output is correct |
29 |
Correct |
4 ms |
7768 KB |
Output is correct |
30 |
Correct |
12 ms |
8956 KB |
Output is correct |
31 |
Correct |
4 ms |
7964 KB |
Output is correct |
32 |
Correct |
17 ms |
8924 KB |
Output is correct |
33 |
Correct |
14 ms |
9188 KB |
Output is correct |
34 |
Correct |
444 ms |
9876 KB |
Output is correct |
35 |
Correct |
157 ms |
9168 KB |
Output is correct |
36 |
Correct |
26 ms |
9324 KB |
Output is correct |
37 |
Correct |
24 ms |
9072 KB |
Output is correct |
38 |
Correct |
19 ms |
8536 KB |
Output is correct |
39 |
Correct |
20 ms |
9476 KB |
Output is correct |
40 |
Correct |
355 ms |
10008 KB |
Output is correct |
41 |
Correct |
81 ms |
9308 KB |
Output is correct |
42 |
Correct |
51 ms |
8692 KB |
Output is correct |
43 |
Correct |
21 ms |
9852 KB |
Output is correct |
44 |
Correct |
238 ms |
10316 KB |
Output is correct |
45 |
Correct |
126 ms |
14644 KB |
Output is correct |
46 |
Correct |
4 ms |
8792 KB |
Output is correct |
47 |
Correct |
5 ms |
9048 KB |
Output is correct |
48 |
Correct |
211 ms |
24376 KB |
Output is correct |
49 |
Correct |
133 ms |
18220 KB |
Output is correct |
50 |
Execution timed out |
4006 ms |
25476 KB |
Time limit exceeded |
51 |
Halted |
0 ms |
0 KB |
- |