#include "game.h"
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=int(a);i<int(b);i++)
#define REP(i,b) FOR(i,0,b)
using vi=vector<int>;
using pi=pair<int,int>;
#define PB push_back
const int Nmax=300010;
vi g[Nmax];
int n,k,reach[Nmax];
void init(int N, int K) {
n=N;
k=K;
REP(i,k)
reach[i]=i;
FOR(i,k,n)
reach[i]=-1;
}
bool dfs(int v,int x){
if(v<k&&v<=x)return true;
if(x<=reach[v])return false;
reach[v]=x;
for(auto to:g[v])
if(dfs(to,reach[v]))return true;
return false;
}
int add_teleporter(int u, int v){
if(max(u,v)<k){
if(u<v)return 0;
else return 1;
}
g[u].PB(v);
return dfs(v,reach[u]);
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
8280 KB |
Output is correct |
2 |
Correct |
2 ms |
8280 KB |
Output is correct |
3 |
Correct |
2 ms |
8280 KB |
Output is correct |
4 |
Correct |
3 ms |
8536 KB |
Output is correct |
5 |
Correct |
2 ms |
8280 KB |
Output is correct |
6 |
Correct |
2 ms |
8368 KB |
Output is correct |
7 |
Correct |
2 ms |
8280 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
8280 KB |
Output is correct |
2 |
Correct |
2 ms |
8280 KB |
Output is correct |
3 |
Correct |
2 ms |
8280 KB |
Output is correct |
4 |
Correct |
3 ms |
8536 KB |
Output is correct |
5 |
Correct |
2 ms |
8280 KB |
Output is correct |
6 |
Correct |
2 ms |
8368 KB |
Output is correct |
7 |
Correct |
2 ms |
8280 KB |
Output is correct |
8 |
Correct |
2 ms |
8280 KB |
Output is correct |
9 |
Correct |
2 ms |
8280 KB |
Output is correct |
10 |
Correct |
2 ms |
8280 KB |
Output is correct |
11 |
Correct |
2 ms |
8280 KB |
Output is correct |
12 |
Correct |
2 ms |
8280 KB |
Output is correct |
13 |
Correct |
2 ms |
8280 KB |
Output is correct |
14 |
Correct |
2 ms |
8280 KB |
Output is correct |
15 |
Correct |
2 ms |
8280 KB |
Output is correct |
16 |
Correct |
2 ms |
8280 KB |
Output is correct |
17 |
Correct |
3 ms |
8280 KB |
Output is correct |
18 |
Correct |
2 ms |
8280 KB |
Output is correct |
19 |
Correct |
2 ms |
8280 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
8280 KB |
Output is correct |
2 |
Correct |
2 ms |
8280 KB |
Output is correct |
3 |
Correct |
2 ms |
8280 KB |
Output is correct |
4 |
Correct |
3 ms |
8536 KB |
Output is correct |
5 |
Correct |
2 ms |
8280 KB |
Output is correct |
6 |
Correct |
2 ms |
8368 KB |
Output is correct |
7 |
Correct |
2 ms |
8280 KB |
Output is correct |
8 |
Correct |
2 ms |
8280 KB |
Output is correct |
9 |
Correct |
2 ms |
8280 KB |
Output is correct |
10 |
Correct |
2 ms |
8280 KB |
Output is correct |
11 |
Correct |
2 ms |
8280 KB |
Output is correct |
12 |
Correct |
2 ms |
8280 KB |
Output is correct |
13 |
Correct |
2 ms |
8280 KB |
Output is correct |
14 |
Correct |
2 ms |
8280 KB |
Output is correct |
15 |
Correct |
2 ms |
8280 KB |
Output is correct |
16 |
Correct |
2 ms |
8280 KB |
Output is correct |
17 |
Correct |
3 ms |
8280 KB |
Output is correct |
18 |
Correct |
2 ms |
8280 KB |
Output is correct |
19 |
Correct |
2 ms |
8280 KB |
Output is correct |
20 |
Correct |
2 ms |
8280 KB |
Output is correct |
21 |
Correct |
2 ms |
8280 KB |
Output is correct |
22 |
Correct |
2 ms |
8280 KB |
Output is correct |
23 |
Correct |
2 ms |
8280 KB |
Output is correct |
24 |
Correct |
4 ms |
8280 KB |
Output is correct |
25 |
Correct |
4 ms |
8536 KB |
Output is correct |
26 |
Correct |
3 ms |
8280 KB |
Output is correct |
27 |
Correct |
4 ms |
8536 KB |
Output is correct |
28 |
Correct |
3 ms |
8280 KB |
Output is correct |
29 |
Correct |
3 ms |
8280 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
8280 KB |
Output is correct |
2 |
Correct |
2 ms |
8280 KB |
Output is correct |
3 |
Correct |
2 ms |
8280 KB |
Output is correct |
4 |
Correct |
3 ms |
8536 KB |
Output is correct |
5 |
Correct |
2 ms |
8280 KB |
Output is correct |
6 |
Correct |
2 ms |
8368 KB |
Output is correct |
7 |
Correct |
2 ms |
8280 KB |
Output is correct |
8 |
Correct |
2 ms |
8280 KB |
Output is correct |
9 |
Correct |
2 ms |
8280 KB |
Output is correct |
10 |
Correct |
2 ms |
8280 KB |
Output is correct |
11 |
Correct |
2 ms |
8280 KB |
Output is correct |
12 |
Correct |
2 ms |
8280 KB |
Output is correct |
13 |
Correct |
2 ms |
8280 KB |
Output is correct |
14 |
Correct |
2 ms |
8280 KB |
Output is correct |
15 |
Correct |
2 ms |
8280 KB |
Output is correct |
16 |
Correct |
2 ms |
8280 KB |
Output is correct |
17 |
Correct |
3 ms |
8280 KB |
Output is correct |
18 |
Correct |
2 ms |
8280 KB |
Output is correct |
19 |
Correct |
2 ms |
8280 KB |
Output is correct |
20 |
Correct |
2 ms |
8280 KB |
Output is correct |
21 |
Correct |
2 ms |
8280 KB |
Output is correct |
22 |
Correct |
2 ms |
8280 KB |
Output is correct |
23 |
Correct |
2 ms |
8280 KB |
Output is correct |
24 |
Correct |
4 ms |
8280 KB |
Output is correct |
25 |
Correct |
4 ms |
8536 KB |
Output is correct |
26 |
Correct |
3 ms |
8280 KB |
Output is correct |
27 |
Correct |
4 ms |
8536 KB |
Output is correct |
28 |
Correct |
3 ms |
8280 KB |
Output is correct |
29 |
Correct |
3 ms |
8280 KB |
Output is correct |
30 |
Correct |
12 ms |
9464 KB |
Output is correct |
31 |
Correct |
5 ms |
8788 KB |
Output is correct |
32 |
Correct |
11 ms |
9864 KB |
Output is correct |
33 |
Correct |
15 ms |
10104 KB |
Output is correct |
34 |
Correct |
444 ms |
11168 KB |
Output is correct |
35 |
Correct |
165 ms |
10592 KB |
Output is correct |
36 |
Correct |
25 ms |
9920 KB |
Output is correct |
37 |
Correct |
21 ms |
10240 KB |
Output is correct |
38 |
Correct |
19 ms |
9808 KB |
Output is correct |
39 |
Correct |
25 ms |
9820 KB |
Output is correct |
40 |
Correct |
386 ms |
11164 KB |
Output is correct |
41 |
Correct |
80 ms |
10256 KB |
Output is correct |
42 |
Correct |
57 ms |
10228 KB |
Output is correct |
43 |
Correct |
31 ms |
11992 KB |
Output is correct |
44 |
Correct |
256 ms |
10728 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
8280 KB |
Output is correct |
2 |
Correct |
2 ms |
8280 KB |
Output is correct |
3 |
Correct |
2 ms |
8280 KB |
Output is correct |
4 |
Correct |
3 ms |
8536 KB |
Output is correct |
5 |
Correct |
2 ms |
8280 KB |
Output is correct |
6 |
Correct |
2 ms |
8368 KB |
Output is correct |
7 |
Correct |
2 ms |
8280 KB |
Output is correct |
8 |
Correct |
2 ms |
8280 KB |
Output is correct |
9 |
Correct |
2 ms |
8280 KB |
Output is correct |
10 |
Correct |
2 ms |
8280 KB |
Output is correct |
11 |
Correct |
2 ms |
8280 KB |
Output is correct |
12 |
Correct |
2 ms |
8280 KB |
Output is correct |
13 |
Correct |
2 ms |
8280 KB |
Output is correct |
14 |
Correct |
2 ms |
8280 KB |
Output is correct |
15 |
Correct |
2 ms |
8280 KB |
Output is correct |
16 |
Correct |
2 ms |
8280 KB |
Output is correct |
17 |
Correct |
3 ms |
8280 KB |
Output is correct |
18 |
Correct |
2 ms |
8280 KB |
Output is correct |
19 |
Correct |
2 ms |
8280 KB |
Output is correct |
20 |
Correct |
2 ms |
8280 KB |
Output is correct |
21 |
Correct |
2 ms |
8280 KB |
Output is correct |
22 |
Correct |
2 ms |
8280 KB |
Output is correct |
23 |
Correct |
2 ms |
8280 KB |
Output is correct |
24 |
Correct |
4 ms |
8280 KB |
Output is correct |
25 |
Correct |
4 ms |
8536 KB |
Output is correct |
26 |
Correct |
3 ms |
8280 KB |
Output is correct |
27 |
Correct |
4 ms |
8536 KB |
Output is correct |
28 |
Correct |
3 ms |
8280 KB |
Output is correct |
29 |
Correct |
3 ms |
8280 KB |
Output is correct |
30 |
Correct |
12 ms |
9464 KB |
Output is correct |
31 |
Correct |
5 ms |
8788 KB |
Output is correct |
32 |
Correct |
11 ms |
9864 KB |
Output is correct |
33 |
Correct |
15 ms |
10104 KB |
Output is correct |
34 |
Correct |
444 ms |
11168 KB |
Output is correct |
35 |
Correct |
165 ms |
10592 KB |
Output is correct |
36 |
Correct |
25 ms |
9920 KB |
Output is correct |
37 |
Correct |
21 ms |
10240 KB |
Output is correct |
38 |
Correct |
19 ms |
9808 KB |
Output is correct |
39 |
Correct |
25 ms |
9820 KB |
Output is correct |
40 |
Correct |
386 ms |
11164 KB |
Output is correct |
41 |
Correct |
80 ms |
10256 KB |
Output is correct |
42 |
Correct |
57 ms |
10228 KB |
Output is correct |
43 |
Correct |
31 ms |
11992 KB |
Output is correct |
44 |
Correct |
256 ms |
10728 KB |
Output is correct |
45 |
Correct |
116 ms |
14800 KB |
Output is correct |
46 |
Correct |
7 ms |
9304 KB |
Output is correct |
47 |
Correct |
6 ms |
9048 KB |
Output is correct |
48 |
Correct |
176 ms |
24628 KB |
Output is correct |
49 |
Correct |
132 ms |
18768 KB |
Output is correct |
50 |
Execution timed out |
4083 ms |
20764 KB |
Time limit exceeded |
51 |
Halted |
0 ms |
0 KB |
- |