#include "game.h"
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define INF 1e18
#define ss second
#define ff first
int n,m,l,r,i,j,k,ii,jj,x,y;
bitset<30001> vis[1001];
vector<int> v[30001];
bool shit;
void init(int N, int K) {
n=N;
k=K;
for(i=0;i<k;i++) vis[i].set(i);
}
void dfs(ll node){
if(shit) return;
if(node<=r){
shit=1;
return;
}
if(vis[i][node]) return;
vis[i].set(node);
for(int it: v[node]) dfs(it);
}
int add_teleporter(int u, int p){
v[u].pb(p);
for(i=0;i<k;i++){
if(vis[i][u]){
shit=0;
r=i;
dfs(p);
if(shit) return 1;
}
}
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
976 KB |
Output is correct |
2 |
Correct |
1 ms |
976 KB |
Output is correct |
3 |
Correct |
1 ms |
1360 KB |
Output is correct |
4 |
Correct |
1 ms |
1104 KB |
Output is correct |
5 |
Correct |
1 ms |
1360 KB |
Output is correct |
6 |
Correct |
1 ms |
1360 KB |
Output is correct |
7 |
Correct |
1 ms |
1376 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
976 KB |
Output is correct |
2 |
Correct |
1 ms |
976 KB |
Output is correct |
3 |
Correct |
1 ms |
1360 KB |
Output is correct |
4 |
Correct |
1 ms |
1104 KB |
Output is correct |
5 |
Correct |
1 ms |
1360 KB |
Output is correct |
6 |
Correct |
1 ms |
1360 KB |
Output is correct |
7 |
Correct |
1 ms |
1376 KB |
Output is correct |
8 |
Correct |
1 ms |
976 KB |
Output is correct |
9 |
Correct |
1 ms |
976 KB |
Output is correct |
10 |
Correct |
1 ms |
1100 KB |
Output is correct |
11 |
Correct |
1 ms |
976 KB |
Output is correct |
12 |
Correct |
1 ms |
976 KB |
Output is correct |
13 |
Correct |
1 ms |
976 KB |
Output is correct |
14 |
Correct |
1 ms |
1104 KB |
Output is correct |
15 |
Correct |
1 ms |
1104 KB |
Output is correct |
16 |
Correct |
1 ms |
1048 KB |
Output is correct |
17 |
Correct |
1 ms |
1104 KB |
Output is correct |
18 |
Correct |
1 ms |
1104 KB |
Output is correct |
19 |
Correct |
1 ms |
1104 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
976 KB |
Output is correct |
2 |
Correct |
1 ms |
976 KB |
Output is correct |
3 |
Correct |
1 ms |
1360 KB |
Output is correct |
4 |
Correct |
1 ms |
1104 KB |
Output is correct |
5 |
Correct |
1 ms |
1360 KB |
Output is correct |
6 |
Correct |
1 ms |
1360 KB |
Output is correct |
7 |
Correct |
1 ms |
1376 KB |
Output is correct |
8 |
Correct |
1 ms |
976 KB |
Output is correct |
9 |
Correct |
1 ms |
976 KB |
Output is correct |
10 |
Correct |
1 ms |
1100 KB |
Output is correct |
11 |
Correct |
1 ms |
976 KB |
Output is correct |
12 |
Correct |
1 ms |
976 KB |
Output is correct |
13 |
Correct |
1 ms |
976 KB |
Output is correct |
14 |
Correct |
1 ms |
1104 KB |
Output is correct |
15 |
Correct |
1 ms |
1104 KB |
Output is correct |
16 |
Correct |
1 ms |
1048 KB |
Output is correct |
17 |
Correct |
1 ms |
1104 KB |
Output is correct |
18 |
Correct |
1 ms |
1104 KB |
Output is correct |
19 |
Correct |
1 ms |
1104 KB |
Output is correct |
20 |
Correct |
1 ms |
976 KB |
Output is correct |
21 |
Correct |
1 ms |
1360 KB |
Output is correct |
22 |
Correct |
1 ms |
1360 KB |
Output is correct |
23 |
Correct |
1 ms |
976 KB |
Output is correct |
24 |
Correct |
5 ms |
2768 KB |
Output is correct |
25 |
Correct |
6 ms |
1932 KB |
Output is correct |
26 |
Correct |
7 ms |
1360 KB |
Output is correct |
27 |
Correct |
10 ms |
2876 KB |
Output is correct |
28 |
Correct |
6 ms |
2768 KB |
Output is correct |
29 |
Correct |
10 ms |
2804 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
976 KB |
Output is correct |
2 |
Correct |
1 ms |
976 KB |
Output is correct |
3 |
Correct |
1 ms |
1360 KB |
Output is correct |
4 |
Correct |
1 ms |
1104 KB |
Output is correct |
5 |
Correct |
1 ms |
1360 KB |
Output is correct |
6 |
Correct |
1 ms |
1360 KB |
Output is correct |
7 |
Correct |
1 ms |
1376 KB |
Output is correct |
8 |
Correct |
1 ms |
976 KB |
Output is correct |
9 |
Correct |
1 ms |
976 KB |
Output is correct |
10 |
Correct |
1 ms |
1100 KB |
Output is correct |
11 |
Correct |
1 ms |
976 KB |
Output is correct |
12 |
Correct |
1 ms |
976 KB |
Output is correct |
13 |
Correct |
1 ms |
976 KB |
Output is correct |
14 |
Correct |
1 ms |
1104 KB |
Output is correct |
15 |
Correct |
1 ms |
1104 KB |
Output is correct |
16 |
Correct |
1 ms |
1048 KB |
Output is correct |
17 |
Correct |
1 ms |
1104 KB |
Output is correct |
18 |
Correct |
1 ms |
1104 KB |
Output is correct |
19 |
Correct |
1 ms |
1104 KB |
Output is correct |
20 |
Correct |
1 ms |
976 KB |
Output is correct |
21 |
Correct |
1 ms |
1360 KB |
Output is correct |
22 |
Correct |
1 ms |
1360 KB |
Output is correct |
23 |
Correct |
1 ms |
976 KB |
Output is correct |
24 |
Correct |
5 ms |
2768 KB |
Output is correct |
25 |
Correct |
6 ms |
1932 KB |
Output is correct |
26 |
Correct |
7 ms |
1360 KB |
Output is correct |
27 |
Correct |
10 ms |
2876 KB |
Output is correct |
28 |
Correct |
6 ms |
2768 KB |
Output is correct |
29 |
Correct |
10 ms |
2804 KB |
Output is correct |
30 |
Correct |
20 ms |
1888 KB |
Output is correct |
31 |
Correct |
30 ms |
4804 KB |
Output is correct |
32 |
Correct |
22 ms |
2372 KB |
Output is correct |
33 |
Correct |
14 ms |
1880 KB |
Output is correct |
34 |
Correct |
534 ms |
6380 KB |
Output is correct |
35 |
Correct |
534 ms |
6180 KB |
Output is correct |
36 |
Correct |
74 ms |
2300 KB |
Output is correct |
37 |
Correct |
463 ms |
5628 KB |
Output is correct |
38 |
Correct |
345 ms |
5328 KB |
Output is correct |
39 |
Correct |
535 ms |
5360 KB |
Output is correct |
40 |
Correct |
555 ms |
6500 KB |
Output is correct |
41 |
Correct |
314 ms |
5824 KB |
Output is correct |
42 |
Correct |
290 ms |
5712 KB |
Output is correct |
43 |
Correct |
531 ms |
6708 KB |
Output is correct |
44 |
Correct |
486 ms |
6468 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
976 KB |
Output is correct |
2 |
Correct |
1 ms |
976 KB |
Output is correct |
3 |
Correct |
1 ms |
1360 KB |
Output is correct |
4 |
Correct |
1 ms |
1104 KB |
Output is correct |
5 |
Correct |
1 ms |
1360 KB |
Output is correct |
6 |
Correct |
1 ms |
1360 KB |
Output is correct |
7 |
Correct |
1 ms |
1376 KB |
Output is correct |
8 |
Correct |
1 ms |
976 KB |
Output is correct |
9 |
Correct |
1 ms |
976 KB |
Output is correct |
10 |
Correct |
1 ms |
1100 KB |
Output is correct |
11 |
Correct |
1 ms |
976 KB |
Output is correct |
12 |
Correct |
1 ms |
976 KB |
Output is correct |
13 |
Correct |
1 ms |
976 KB |
Output is correct |
14 |
Correct |
1 ms |
1104 KB |
Output is correct |
15 |
Correct |
1 ms |
1104 KB |
Output is correct |
16 |
Correct |
1 ms |
1048 KB |
Output is correct |
17 |
Correct |
1 ms |
1104 KB |
Output is correct |
18 |
Correct |
1 ms |
1104 KB |
Output is correct |
19 |
Correct |
1 ms |
1104 KB |
Output is correct |
20 |
Correct |
1 ms |
976 KB |
Output is correct |
21 |
Correct |
1 ms |
1360 KB |
Output is correct |
22 |
Correct |
1 ms |
1360 KB |
Output is correct |
23 |
Correct |
1 ms |
976 KB |
Output is correct |
24 |
Correct |
5 ms |
2768 KB |
Output is correct |
25 |
Correct |
6 ms |
1932 KB |
Output is correct |
26 |
Correct |
7 ms |
1360 KB |
Output is correct |
27 |
Correct |
10 ms |
2876 KB |
Output is correct |
28 |
Correct |
6 ms |
2768 KB |
Output is correct |
29 |
Correct |
10 ms |
2804 KB |
Output is correct |
30 |
Correct |
20 ms |
1888 KB |
Output is correct |
31 |
Correct |
30 ms |
4804 KB |
Output is correct |
32 |
Correct |
22 ms |
2372 KB |
Output is correct |
33 |
Correct |
14 ms |
1880 KB |
Output is correct |
34 |
Correct |
534 ms |
6380 KB |
Output is correct |
35 |
Correct |
534 ms |
6180 KB |
Output is correct |
36 |
Correct |
74 ms |
2300 KB |
Output is correct |
37 |
Correct |
463 ms |
5628 KB |
Output is correct |
38 |
Correct |
345 ms |
5328 KB |
Output is correct |
39 |
Correct |
535 ms |
5360 KB |
Output is correct |
40 |
Correct |
555 ms |
6500 KB |
Output is correct |
41 |
Correct |
314 ms |
5824 KB |
Output is correct |
42 |
Correct |
290 ms |
5712 KB |
Output is correct |
43 |
Correct |
531 ms |
6708 KB |
Output is correct |
44 |
Correct |
486 ms |
6468 KB |
Output is correct |
45 |
Runtime error |
2 ms |
2520 KB |
Execution killed with signal 11 |
46 |
Halted |
0 ms |
0 KB |
- |