# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
586227 |
2022-06-30T05:12:41 Z |
jamezzz |
Game (APIO22_game) |
C++17 |
|
4000 ms |
17708 KB |
#include "game.h"
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define maxn 300005
int n,k;
bool vis[maxn];
vector<int> AL[maxn],AL2[maxn];
int dfs(int u){
vis[u]=true;
int ans=min(u,k);
for(int v:AL[u]){
if(!vis[v]){
ans=min(ans,dfs(v));
}
}
return ans;
}
int dfs2(int u){
vis[u]=true;
int ans=-1;
if(u<k)ans=u;
for(int v:AL2[u]){
if(!vis[v]){
ans=max(ans,dfs2(v));
}
}
return ans;
}
void init(int _n,int _k){
n=_n;k=_k;
}
int add_teleporter(int u,int v){
AL[u].pb(v);
AL2[v].pb(u);
for(int i=0;i<n;++i)vis[i]=false;
int low=dfs(v);
for(int i=0;i<n;++i)vis[i]=false;
int high=dfs2(u);
if(low<=high)return 1;
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
8 ms |
14288 KB |
Output is correct |
2 |
Correct |
7 ms |
14288 KB |
Output is correct |
3 |
Correct |
8 ms |
14288 KB |
Output is correct |
4 |
Correct |
8 ms |
14288 KB |
Output is correct |
5 |
Correct |
7 ms |
14288 KB |
Output is correct |
6 |
Correct |
8 ms |
14288 KB |
Output is correct |
7 |
Correct |
8 ms |
14288 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
8 ms |
14288 KB |
Output is correct |
2 |
Correct |
7 ms |
14288 KB |
Output is correct |
3 |
Correct |
8 ms |
14288 KB |
Output is correct |
4 |
Correct |
8 ms |
14288 KB |
Output is correct |
5 |
Correct |
7 ms |
14288 KB |
Output is correct |
6 |
Correct |
8 ms |
14288 KB |
Output is correct |
7 |
Correct |
8 ms |
14288 KB |
Output is correct |
8 |
Correct |
9 ms |
14288 KB |
Output is correct |
9 |
Correct |
7 ms |
14284 KB |
Output is correct |
10 |
Correct |
7 ms |
14288 KB |
Output is correct |
11 |
Correct |
6 ms |
14288 KB |
Output is correct |
12 |
Correct |
7 ms |
14288 KB |
Output is correct |
13 |
Correct |
8 ms |
14416 KB |
Output is correct |
14 |
Correct |
10 ms |
14348 KB |
Output is correct |
15 |
Correct |
8 ms |
14288 KB |
Output is correct |
16 |
Correct |
8 ms |
14288 KB |
Output is correct |
17 |
Correct |
7 ms |
14344 KB |
Output is correct |
18 |
Correct |
8 ms |
14288 KB |
Output is correct |
19 |
Correct |
7 ms |
14384 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
8 ms |
14288 KB |
Output is correct |
2 |
Correct |
7 ms |
14288 KB |
Output is correct |
3 |
Correct |
8 ms |
14288 KB |
Output is correct |
4 |
Correct |
8 ms |
14288 KB |
Output is correct |
5 |
Correct |
7 ms |
14288 KB |
Output is correct |
6 |
Correct |
8 ms |
14288 KB |
Output is correct |
7 |
Correct |
8 ms |
14288 KB |
Output is correct |
8 |
Correct |
9 ms |
14288 KB |
Output is correct |
9 |
Correct |
7 ms |
14284 KB |
Output is correct |
10 |
Correct |
7 ms |
14288 KB |
Output is correct |
11 |
Correct |
6 ms |
14288 KB |
Output is correct |
12 |
Correct |
7 ms |
14288 KB |
Output is correct |
13 |
Correct |
8 ms |
14416 KB |
Output is correct |
14 |
Correct |
10 ms |
14348 KB |
Output is correct |
15 |
Correct |
8 ms |
14288 KB |
Output is correct |
16 |
Correct |
8 ms |
14288 KB |
Output is correct |
17 |
Correct |
7 ms |
14344 KB |
Output is correct |
18 |
Correct |
8 ms |
14288 KB |
Output is correct |
19 |
Correct |
7 ms |
14384 KB |
Output is correct |
20 |
Correct |
8 ms |
14416 KB |
Output is correct |
21 |
Correct |
7 ms |
14288 KB |
Output is correct |
22 |
Correct |
8 ms |
14416 KB |
Output is correct |
23 |
Correct |
8 ms |
14416 KB |
Output is correct |
24 |
Correct |
11 ms |
14416 KB |
Output is correct |
25 |
Correct |
18 ms |
14492 KB |
Output is correct |
26 |
Correct |
33 ms |
14480 KB |
Output is correct |
27 |
Correct |
14 ms |
14400 KB |
Output is correct |
28 |
Correct |
10 ms |
14416 KB |
Output is correct |
29 |
Correct |
11 ms |
14416 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
8 ms |
14288 KB |
Output is correct |
2 |
Correct |
7 ms |
14288 KB |
Output is correct |
3 |
Correct |
8 ms |
14288 KB |
Output is correct |
4 |
Correct |
8 ms |
14288 KB |
Output is correct |
5 |
Correct |
7 ms |
14288 KB |
Output is correct |
6 |
Correct |
8 ms |
14288 KB |
Output is correct |
7 |
Correct |
8 ms |
14288 KB |
Output is correct |
8 |
Correct |
9 ms |
14288 KB |
Output is correct |
9 |
Correct |
7 ms |
14284 KB |
Output is correct |
10 |
Correct |
7 ms |
14288 KB |
Output is correct |
11 |
Correct |
6 ms |
14288 KB |
Output is correct |
12 |
Correct |
7 ms |
14288 KB |
Output is correct |
13 |
Correct |
8 ms |
14416 KB |
Output is correct |
14 |
Correct |
10 ms |
14348 KB |
Output is correct |
15 |
Correct |
8 ms |
14288 KB |
Output is correct |
16 |
Correct |
8 ms |
14288 KB |
Output is correct |
17 |
Correct |
7 ms |
14344 KB |
Output is correct |
18 |
Correct |
8 ms |
14288 KB |
Output is correct |
19 |
Correct |
7 ms |
14384 KB |
Output is correct |
20 |
Correct |
8 ms |
14416 KB |
Output is correct |
21 |
Correct |
7 ms |
14288 KB |
Output is correct |
22 |
Correct |
8 ms |
14416 KB |
Output is correct |
23 |
Correct |
8 ms |
14416 KB |
Output is correct |
24 |
Correct |
11 ms |
14416 KB |
Output is correct |
25 |
Correct |
18 ms |
14492 KB |
Output is correct |
26 |
Correct |
33 ms |
14480 KB |
Output is correct |
27 |
Correct |
14 ms |
14400 KB |
Output is correct |
28 |
Correct |
10 ms |
14416 KB |
Output is correct |
29 |
Correct |
11 ms |
14416 KB |
Output is correct |
30 |
Correct |
73 ms |
15556 KB |
Output is correct |
31 |
Correct |
22 ms |
14760 KB |
Output is correct |
32 |
Correct |
102 ms |
16948 KB |
Output is correct |
33 |
Correct |
81 ms |
16252 KB |
Output is correct |
34 |
Correct |
1131 ms |
17608 KB |
Output is correct |
35 |
Correct |
1578 ms |
17252 KB |
Output is correct |
36 |
Correct |
2278 ms |
16268 KB |
Output is correct |
37 |
Correct |
1279 ms |
16356 KB |
Output is correct |
38 |
Correct |
936 ms |
16052 KB |
Output is correct |
39 |
Correct |
1038 ms |
16000 KB |
Output is correct |
40 |
Correct |
1060 ms |
17664 KB |
Output is correct |
41 |
Correct |
1012 ms |
16768 KB |
Output is correct |
42 |
Correct |
447 ms |
16468 KB |
Output is correct |
43 |
Execution timed out |
4059 ms |
17708 KB |
Time limit exceeded |
44 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
8 ms |
14288 KB |
Output is correct |
2 |
Correct |
7 ms |
14288 KB |
Output is correct |
3 |
Correct |
8 ms |
14288 KB |
Output is correct |
4 |
Correct |
8 ms |
14288 KB |
Output is correct |
5 |
Correct |
7 ms |
14288 KB |
Output is correct |
6 |
Correct |
8 ms |
14288 KB |
Output is correct |
7 |
Correct |
8 ms |
14288 KB |
Output is correct |
8 |
Correct |
9 ms |
14288 KB |
Output is correct |
9 |
Correct |
7 ms |
14284 KB |
Output is correct |
10 |
Correct |
7 ms |
14288 KB |
Output is correct |
11 |
Correct |
6 ms |
14288 KB |
Output is correct |
12 |
Correct |
7 ms |
14288 KB |
Output is correct |
13 |
Correct |
8 ms |
14416 KB |
Output is correct |
14 |
Correct |
10 ms |
14348 KB |
Output is correct |
15 |
Correct |
8 ms |
14288 KB |
Output is correct |
16 |
Correct |
8 ms |
14288 KB |
Output is correct |
17 |
Correct |
7 ms |
14344 KB |
Output is correct |
18 |
Correct |
8 ms |
14288 KB |
Output is correct |
19 |
Correct |
7 ms |
14384 KB |
Output is correct |
20 |
Correct |
8 ms |
14416 KB |
Output is correct |
21 |
Correct |
7 ms |
14288 KB |
Output is correct |
22 |
Correct |
8 ms |
14416 KB |
Output is correct |
23 |
Correct |
8 ms |
14416 KB |
Output is correct |
24 |
Correct |
11 ms |
14416 KB |
Output is correct |
25 |
Correct |
18 ms |
14492 KB |
Output is correct |
26 |
Correct |
33 ms |
14480 KB |
Output is correct |
27 |
Correct |
14 ms |
14400 KB |
Output is correct |
28 |
Correct |
10 ms |
14416 KB |
Output is correct |
29 |
Correct |
11 ms |
14416 KB |
Output is correct |
30 |
Correct |
73 ms |
15556 KB |
Output is correct |
31 |
Correct |
22 ms |
14760 KB |
Output is correct |
32 |
Correct |
102 ms |
16948 KB |
Output is correct |
33 |
Correct |
81 ms |
16252 KB |
Output is correct |
34 |
Correct |
1131 ms |
17608 KB |
Output is correct |
35 |
Correct |
1578 ms |
17252 KB |
Output is correct |
36 |
Correct |
2278 ms |
16268 KB |
Output is correct |
37 |
Correct |
1279 ms |
16356 KB |
Output is correct |
38 |
Correct |
936 ms |
16052 KB |
Output is correct |
39 |
Correct |
1038 ms |
16000 KB |
Output is correct |
40 |
Correct |
1060 ms |
17664 KB |
Output is correct |
41 |
Correct |
1012 ms |
16768 KB |
Output is correct |
42 |
Correct |
447 ms |
16468 KB |
Output is correct |
43 |
Execution timed out |
4059 ms |
17708 KB |
Time limit exceeded |
44 |
Halted |
0 ms |
0 KB |
- |