# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
586268 |
2022-06-30T05:52:38 Z |
jamezzz |
Game (APIO22_game) |
C++17 |
|
4000 ms |
38376 KB |
#include "game.h"
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define maxn 300005
int n,k,low[maxn],high[maxn];
vector<int> AL[maxn],AL2[maxn];
void dfs(int u,int x){
for(int v:AL[u]){
if(high[v]<x){
high[v]=x;
dfs(v,x);
}
}
}
void dfs2(int u,int x){
for(int v:AL2[u]){
if(x<low[v]){
low[v]=x;
dfs2(v,x);
}
}
}
void init(int _n,int _k){
n=_n;k=_k;
for(int i=0;i<k;++i){
low[i]=high[i]=i;
}
for(int i=k;i<n;++i){
high[i]=-1;
low[i]=k;
}
for(int i=0;i<k-1;++i){
AL[i].pb(i+1);
AL2[i+1].pb(i);
}
}
int add_teleporter(int u,int v){
if(v<=u&&u<k)return 1;
AL[u].pb(v);
AL2[v].pb(u);
dfs(u,high[u]);
dfs2(v,low[v]);
/*
printf("low: ");
for(int i=0;i<n;++i)printf("%d ",low[i]);
printf("\n");
printf("high: ");
for(int i=0;i<n;++i)printf("%d ",high[i]);
printf("\n");
*/
if(u>=k&&low[u]<=high[u])return 1;
if(v>=k&&low[v]<=high[v])return 1;
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
7 ms |
14288 KB |
Output is correct |
2 |
Correct |
9 ms |
14288 KB |
Output is correct |
3 |
Correct |
7 ms |
14340 KB |
Output is correct |
4 |
Correct |
7 ms |
14288 KB |
Output is correct |
5 |
Correct |
8 ms |
14288 KB |
Output is correct |
6 |
Correct |
9 ms |
14320 KB |
Output is correct |
7 |
Correct |
8 ms |
14288 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
7 ms |
14288 KB |
Output is correct |
2 |
Correct |
9 ms |
14288 KB |
Output is correct |
3 |
Correct |
7 ms |
14340 KB |
Output is correct |
4 |
Correct |
7 ms |
14288 KB |
Output is correct |
5 |
Correct |
8 ms |
14288 KB |
Output is correct |
6 |
Correct |
9 ms |
14320 KB |
Output is correct |
7 |
Correct |
8 ms |
14288 KB |
Output is correct |
8 |
Correct |
7 ms |
14396 KB |
Output is correct |
9 |
Correct |
7 ms |
14300 KB |
Output is correct |
10 |
Correct |
7 ms |
14292 KB |
Output is correct |
11 |
Correct |
7 ms |
14288 KB |
Output is correct |
12 |
Correct |
7 ms |
14288 KB |
Output is correct |
13 |
Correct |
8 ms |
14300 KB |
Output is correct |
14 |
Correct |
7 ms |
14288 KB |
Output is correct |
15 |
Correct |
7 ms |
14412 KB |
Output is correct |
16 |
Correct |
7 ms |
14288 KB |
Output is correct |
17 |
Correct |
8 ms |
14412 KB |
Output is correct |
18 |
Correct |
9 ms |
14416 KB |
Output is correct |
19 |
Correct |
8 ms |
14288 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
7 ms |
14288 KB |
Output is correct |
2 |
Correct |
9 ms |
14288 KB |
Output is correct |
3 |
Correct |
7 ms |
14340 KB |
Output is correct |
4 |
Correct |
7 ms |
14288 KB |
Output is correct |
5 |
Correct |
8 ms |
14288 KB |
Output is correct |
6 |
Correct |
9 ms |
14320 KB |
Output is correct |
7 |
Correct |
8 ms |
14288 KB |
Output is correct |
8 |
Correct |
7 ms |
14396 KB |
Output is correct |
9 |
Correct |
7 ms |
14300 KB |
Output is correct |
10 |
Correct |
7 ms |
14292 KB |
Output is correct |
11 |
Correct |
7 ms |
14288 KB |
Output is correct |
12 |
Correct |
7 ms |
14288 KB |
Output is correct |
13 |
Correct |
8 ms |
14300 KB |
Output is correct |
14 |
Correct |
7 ms |
14288 KB |
Output is correct |
15 |
Correct |
7 ms |
14412 KB |
Output is correct |
16 |
Correct |
7 ms |
14288 KB |
Output is correct |
17 |
Correct |
8 ms |
14412 KB |
Output is correct |
18 |
Correct |
9 ms |
14416 KB |
Output is correct |
19 |
Correct |
8 ms |
14288 KB |
Output is correct |
20 |
Correct |
9 ms |
14392 KB |
Output is correct |
21 |
Correct |
8 ms |
14416 KB |
Output is correct |
22 |
Correct |
8 ms |
14424 KB |
Output is correct |
23 |
Correct |
8 ms |
14416 KB |
Output is correct |
24 |
Correct |
11 ms |
14416 KB |
Output is correct |
25 |
Correct |
9 ms |
14416 KB |
Output is correct |
26 |
Correct |
11 ms |
14468 KB |
Output is correct |
27 |
Correct |
10 ms |
14448 KB |
Output is correct |
28 |
Correct |
8 ms |
14416 KB |
Output is correct |
29 |
Correct |
9 ms |
14372 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
7 ms |
14288 KB |
Output is correct |
2 |
Correct |
9 ms |
14288 KB |
Output is correct |
3 |
Correct |
7 ms |
14340 KB |
Output is correct |
4 |
Correct |
7 ms |
14288 KB |
Output is correct |
5 |
Correct |
8 ms |
14288 KB |
Output is correct |
6 |
Correct |
9 ms |
14320 KB |
Output is correct |
7 |
Correct |
8 ms |
14288 KB |
Output is correct |
8 |
Correct |
7 ms |
14396 KB |
Output is correct |
9 |
Correct |
7 ms |
14300 KB |
Output is correct |
10 |
Correct |
7 ms |
14292 KB |
Output is correct |
11 |
Correct |
7 ms |
14288 KB |
Output is correct |
12 |
Correct |
7 ms |
14288 KB |
Output is correct |
13 |
Correct |
8 ms |
14300 KB |
Output is correct |
14 |
Correct |
7 ms |
14288 KB |
Output is correct |
15 |
Correct |
7 ms |
14412 KB |
Output is correct |
16 |
Correct |
7 ms |
14288 KB |
Output is correct |
17 |
Correct |
8 ms |
14412 KB |
Output is correct |
18 |
Correct |
9 ms |
14416 KB |
Output is correct |
19 |
Correct |
8 ms |
14288 KB |
Output is correct |
20 |
Correct |
9 ms |
14392 KB |
Output is correct |
21 |
Correct |
8 ms |
14416 KB |
Output is correct |
22 |
Correct |
8 ms |
14424 KB |
Output is correct |
23 |
Correct |
8 ms |
14416 KB |
Output is correct |
24 |
Correct |
11 ms |
14416 KB |
Output is correct |
25 |
Correct |
9 ms |
14416 KB |
Output is correct |
26 |
Correct |
11 ms |
14468 KB |
Output is correct |
27 |
Correct |
10 ms |
14448 KB |
Output is correct |
28 |
Correct |
8 ms |
14416 KB |
Output is correct |
29 |
Correct |
9 ms |
14372 KB |
Output is correct |
30 |
Correct |
24 ms |
15684 KB |
Output is correct |
31 |
Correct |
12 ms |
15020 KB |
Output is correct |
32 |
Correct |
30 ms |
16708 KB |
Output is correct |
33 |
Correct |
32 ms |
16456 KB |
Output is correct |
34 |
Correct |
957 ms |
17056 KB |
Output is correct |
35 |
Correct |
360 ms |
16684 KB |
Output is correct |
36 |
Correct |
48 ms |
16420 KB |
Output is correct |
37 |
Correct |
53 ms |
16432 KB |
Output is correct |
38 |
Correct |
39 ms |
16200 KB |
Output is correct |
39 |
Correct |
36 ms |
16272 KB |
Output is correct |
40 |
Correct |
828 ms |
17072 KB |
Output is correct |
41 |
Correct |
165 ms |
16432 KB |
Output is correct |
42 |
Correct |
124 ms |
16396 KB |
Output is correct |
43 |
Correct |
73 ms |
17192 KB |
Output is correct |
44 |
Correct |
846 ms |
17100 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
7 ms |
14288 KB |
Output is correct |
2 |
Correct |
9 ms |
14288 KB |
Output is correct |
3 |
Correct |
7 ms |
14340 KB |
Output is correct |
4 |
Correct |
7 ms |
14288 KB |
Output is correct |
5 |
Correct |
8 ms |
14288 KB |
Output is correct |
6 |
Correct |
9 ms |
14320 KB |
Output is correct |
7 |
Correct |
8 ms |
14288 KB |
Output is correct |
8 |
Correct |
7 ms |
14396 KB |
Output is correct |
9 |
Correct |
7 ms |
14300 KB |
Output is correct |
10 |
Correct |
7 ms |
14292 KB |
Output is correct |
11 |
Correct |
7 ms |
14288 KB |
Output is correct |
12 |
Correct |
7 ms |
14288 KB |
Output is correct |
13 |
Correct |
8 ms |
14300 KB |
Output is correct |
14 |
Correct |
7 ms |
14288 KB |
Output is correct |
15 |
Correct |
7 ms |
14412 KB |
Output is correct |
16 |
Correct |
7 ms |
14288 KB |
Output is correct |
17 |
Correct |
8 ms |
14412 KB |
Output is correct |
18 |
Correct |
9 ms |
14416 KB |
Output is correct |
19 |
Correct |
8 ms |
14288 KB |
Output is correct |
20 |
Correct |
9 ms |
14392 KB |
Output is correct |
21 |
Correct |
8 ms |
14416 KB |
Output is correct |
22 |
Correct |
8 ms |
14424 KB |
Output is correct |
23 |
Correct |
8 ms |
14416 KB |
Output is correct |
24 |
Correct |
11 ms |
14416 KB |
Output is correct |
25 |
Correct |
9 ms |
14416 KB |
Output is correct |
26 |
Correct |
11 ms |
14468 KB |
Output is correct |
27 |
Correct |
10 ms |
14448 KB |
Output is correct |
28 |
Correct |
8 ms |
14416 KB |
Output is correct |
29 |
Correct |
9 ms |
14372 KB |
Output is correct |
30 |
Correct |
24 ms |
15684 KB |
Output is correct |
31 |
Correct |
12 ms |
15020 KB |
Output is correct |
32 |
Correct |
30 ms |
16708 KB |
Output is correct |
33 |
Correct |
32 ms |
16456 KB |
Output is correct |
34 |
Correct |
957 ms |
17056 KB |
Output is correct |
35 |
Correct |
360 ms |
16684 KB |
Output is correct |
36 |
Correct |
48 ms |
16420 KB |
Output is correct |
37 |
Correct |
53 ms |
16432 KB |
Output is correct |
38 |
Correct |
39 ms |
16200 KB |
Output is correct |
39 |
Correct |
36 ms |
16272 KB |
Output is correct |
40 |
Correct |
828 ms |
17072 KB |
Output is correct |
41 |
Correct |
165 ms |
16432 KB |
Output is correct |
42 |
Correct |
124 ms |
16396 KB |
Output is correct |
43 |
Correct |
73 ms |
17192 KB |
Output is correct |
44 |
Correct |
846 ms |
17100 KB |
Output is correct |
45 |
Correct |
314 ms |
28008 KB |
Output is correct |
46 |
Correct |
19 ms |
17232 KB |
Output is correct |
47 |
Correct |
18 ms |
17224 KB |
Output is correct |
48 |
Correct |
404 ms |
38328 KB |
Output is correct |
49 |
Correct |
322 ms |
35460 KB |
Output is correct |
50 |
Execution timed out |
4064 ms |
38376 KB |
Time limit exceeded |
51 |
Halted |
0 ms |
0 KB |
- |