#include "game.h"
#include<bits/stdc++.h>
using namespace std;
int N,K;
bool vis[30010],top[30010];
vector<int> adj[30010];
void init(int n, int k) {
N=n;K=k;
for(int i=0; i<k-1; i++){
adj[i].push_back(i+1);
}
}
bool ord(int a){
if(vis[a] && top[a]==0 && a<K){
//cout<<'>'<<a<<endl;
return true;
}
if(vis[a])return false;
vis[a] = true;
for (int it: adj[a]){
if(ord(it)){
//cout<<'>'<<a<<endl;
return true;
}
}
top[a]=1;
return false;
}
int add_teleporter(int u, int v) {
for(int i=0; i<N; i++)vis[i]=0,top[i]=0;
adj[u].push_back(v);
for(int i=0; i<N; i++)if(!vis[i])if(ord(i))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 |
976 KB |
Output is correct |
4 |
Correct |
1 ms |
976 KB |
Output is correct |
5 |
Correct |
1 ms |
976 KB |
Output is correct |
6 |
Correct |
2 ms |
976 KB |
Output is correct |
7 |
Correct |
1 ms |
976 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 |
976 KB |
Output is correct |
4 |
Correct |
1 ms |
976 KB |
Output is correct |
5 |
Correct |
1 ms |
976 KB |
Output is correct |
6 |
Correct |
2 ms |
976 KB |
Output is correct |
7 |
Correct |
1 ms |
976 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 |
976 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 |
976 KB |
Output is correct |
15 |
Correct |
1 ms |
976 KB |
Output is correct |
16 |
Correct |
2 ms |
976 KB |
Output is correct |
17 |
Correct |
1 ms |
976 KB |
Output is correct |
18 |
Correct |
1 ms |
976 KB |
Output is correct |
19 |
Correct |
1 ms |
976 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 |
976 KB |
Output is correct |
4 |
Correct |
1 ms |
976 KB |
Output is correct |
5 |
Correct |
1 ms |
976 KB |
Output is correct |
6 |
Correct |
2 ms |
976 KB |
Output is correct |
7 |
Correct |
1 ms |
976 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 |
976 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 |
976 KB |
Output is correct |
15 |
Correct |
1 ms |
976 KB |
Output is correct |
16 |
Correct |
2 ms |
976 KB |
Output is correct |
17 |
Correct |
1 ms |
976 KB |
Output is correct |
18 |
Correct |
1 ms |
976 KB |
Output is correct |
19 |
Correct |
1 ms |
976 KB |
Output is correct |
20 |
Correct |
9 ms |
976 KB |
Output is correct |
21 |
Correct |
2 ms |
952 KB |
Output is correct |
22 |
Correct |
9 ms |
1032 KB |
Output is correct |
23 |
Correct |
12 ms |
1044 KB |
Output is correct |
24 |
Correct |
11 ms |
976 KB |
Output is correct |
25 |
Correct |
76 ms |
1052 KB |
Output is correct |
26 |
Correct |
95 ms |
976 KB |
Output is correct |
27 |
Correct |
72 ms |
1068 KB |
Output is correct |
28 |
Correct |
28 ms |
976 KB |
Output is correct |
29 |
Correct |
67 ms |
976 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 |
976 KB |
Output is correct |
4 |
Correct |
1 ms |
976 KB |
Output is correct |
5 |
Correct |
1 ms |
976 KB |
Output is correct |
6 |
Correct |
2 ms |
976 KB |
Output is correct |
7 |
Correct |
1 ms |
976 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 |
976 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 |
976 KB |
Output is correct |
15 |
Correct |
1 ms |
976 KB |
Output is correct |
16 |
Correct |
2 ms |
976 KB |
Output is correct |
17 |
Correct |
1 ms |
976 KB |
Output is correct |
18 |
Correct |
1 ms |
976 KB |
Output is correct |
19 |
Correct |
1 ms |
976 KB |
Output is correct |
20 |
Correct |
9 ms |
976 KB |
Output is correct |
21 |
Correct |
2 ms |
952 KB |
Output is correct |
22 |
Correct |
9 ms |
1032 KB |
Output is correct |
23 |
Correct |
12 ms |
1044 KB |
Output is correct |
24 |
Correct |
11 ms |
976 KB |
Output is correct |
25 |
Correct |
76 ms |
1052 KB |
Output is correct |
26 |
Correct |
95 ms |
976 KB |
Output is correct |
27 |
Correct |
72 ms |
1068 KB |
Output is correct |
28 |
Correct |
28 ms |
976 KB |
Output is correct |
29 |
Correct |
67 ms |
976 KB |
Output is correct |
30 |
Execution timed out |
4030 ms |
1556 KB |
Time limit exceeded |
31 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
976 KB |
Output is correct |
2 |
Correct |
1 ms |
976 KB |
Output is correct |
3 |
Correct |
1 ms |
976 KB |
Output is correct |
4 |
Correct |
1 ms |
976 KB |
Output is correct |
5 |
Correct |
1 ms |
976 KB |
Output is correct |
6 |
Correct |
2 ms |
976 KB |
Output is correct |
7 |
Correct |
1 ms |
976 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 |
976 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 |
976 KB |
Output is correct |
15 |
Correct |
1 ms |
976 KB |
Output is correct |
16 |
Correct |
2 ms |
976 KB |
Output is correct |
17 |
Correct |
1 ms |
976 KB |
Output is correct |
18 |
Correct |
1 ms |
976 KB |
Output is correct |
19 |
Correct |
1 ms |
976 KB |
Output is correct |
20 |
Correct |
9 ms |
976 KB |
Output is correct |
21 |
Correct |
2 ms |
952 KB |
Output is correct |
22 |
Correct |
9 ms |
1032 KB |
Output is correct |
23 |
Correct |
12 ms |
1044 KB |
Output is correct |
24 |
Correct |
11 ms |
976 KB |
Output is correct |
25 |
Correct |
76 ms |
1052 KB |
Output is correct |
26 |
Correct |
95 ms |
976 KB |
Output is correct |
27 |
Correct |
72 ms |
1068 KB |
Output is correct |
28 |
Correct |
28 ms |
976 KB |
Output is correct |
29 |
Correct |
67 ms |
976 KB |
Output is correct |
30 |
Execution timed out |
4030 ms |
1556 KB |
Time limit exceeded |
31 |
Halted |
0 ms |
0 KB |
- |