# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1003172 |
2024-06-20T07:10:56 Z |
Otalp |
Game (APIO22_game) |
C++17 |
|
1002 ms |
19544 KB |
#include "game.h"
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
vector<int> q[200100], dq[200100];
int n, k;
int mn[200100];
int mx[200100];
int ok = 1;
void init(int N, int K) {
n = N;
k = K;
ok = 1;
for(int i=0; i<n; i++){
q[i].clear();
dq[i].clear();
}
for(int i=0; i<k-1; i++){
q[i].pb(i + 1);
dq[i + 1].pb(i);
}
for(int i=0; i<k; i++){
if(i < k-1) mn[i] = i + 1;
else mn[i] = 1e9;
mx[i] = i;
}
for(int i=k; i<n; i++){
mn[i] = 1e9;
mx[i] = -1;
}
}
void dfsmn(int v, int x){
mn[v] = x;
if(mn[v] <= mx[v] and mx[v] < k) ok = 0;
for(int to: dq[v]){
if(mn[to] > x){
dfsmn(to, x);
}
}
}
void dfsmx(int v, int x){
mx[v] = x;
if(mn[v] <= mx[v] and mx[v] < k) ok = 0;
for(int to: q[v]){
if(mx[to] < x){
dfsmx(to, x);
}
}
}
int add_teleporter(int u, int v) {
//cout<<"______________________\n";
//cout<<u<<' '<<v<<'\n';
q[u].pb(v);
dq[v].pb(u);
if(v < k) mn[u] = min(v, mn[u]);
if(u < k) mx[v] = max(u, mx[v]);
dfsmn(u, min(mn[v], mn[u]));
dfsmx(v, max(mx[v], mx[u]));
//for(int i=0; i<n; i++){
// cout<<mn[i]<<' '<<mx[i]<<'\n';
//}
return !ok;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
9816 KB |
Output is correct |
2 |
Correct |
4 ms |
9816 KB |
Output is correct |
3 |
Correct |
4 ms |
9816 KB |
Output is correct |
4 |
Correct |
5 ms |
9816 KB |
Output is correct |
5 |
Correct |
4 ms |
9816 KB |
Output is correct |
6 |
Correct |
3 ms |
9816 KB |
Output is correct |
7 |
Correct |
4 ms |
9816 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
9816 KB |
Output is correct |
2 |
Correct |
4 ms |
9816 KB |
Output is correct |
3 |
Correct |
4 ms |
9816 KB |
Output is correct |
4 |
Correct |
5 ms |
9816 KB |
Output is correct |
5 |
Correct |
4 ms |
9816 KB |
Output is correct |
6 |
Correct |
3 ms |
9816 KB |
Output is correct |
7 |
Correct |
4 ms |
9816 KB |
Output is correct |
8 |
Correct |
5 ms |
9816 KB |
Output is correct |
9 |
Correct |
4 ms |
9816 KB |
Output is correct |
10 |
Correct |
4 ms |
9816 KB |
Output is correct |
11 |
Correct |
4 ms |
9816 KB |
Output is correct |
12 |
Correct |
4 ms |
9816 KB |
Output is correct |
13 |
Correct |
4 ms |
9816 KB |
Output is correct |
14 |
Correct |
5 ms |
9816 KB |
Output is correct |
15 |
Correct |
6 ms |
10072 KB |
Output is correct |
16 |
Correct |
4 ms |
9816 KB |
Output is correct |
17 |
Correct |
4 ms |
9816 KB |
Output is correct |
18 |
Correct |
4 ms |
9816 KB |
Output is correct |
19 |
Correct |
4 ms |
9816 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
9816 KB |
Output is correct |
2 |
Correct |
4 ms |
9816 KB |
Output is correct |
3 |
Correct |
4 ms |
9816 KB |
Output is correct |
4 |
Correct |
5 ms |
9816 KB |
Output is correct |
5 |
Correct |
4 ms |
9816 KB |
Output is correct |
6 |
Correct |
3 ms |
9816 KB |
Output is correct |
7 |
Correct |
4 ms |
9816 KB |
Output is correct |
8 |
Correct |
5 ms |
9816 KB |
Output is correct |
9 |
Correct |
4 ms |
9816 KB |
Output is correct |
10 |
Correct |
4 ms |
9816 KB |
Output is correct |
11 |
Correct |
4 ms |
9816 KB |
Output is correct |
12 |
Correct |
4 ms |
9816 KB |
Output is correct |
13 |
Correct |
4 ms |
9816 KB |
Output is correct |
14 |
Correct |
5 ms |
9816 KB |
Output is correct |
15 |
Correct |
6 ms |
10072 KB |
Output is correct |
16 |
Correct |
4 ms |
9816 KB |
Output is correct |
17 |
Correct |
4 ms |
9816 KB |
Output is correct |
18 |
Correct |
4 ms |
9816 KB |
Output is correct |
19 |
Correct |
4 ms |
9816 KB |
Output is correct |
20 |
Correct |
4 ms |
9816 KB |
Output is correct |
21 |
Correct |
4 ms |
9816 KB |
Output is correct |
22 |
Correct |
4 ms |
9816 KB |
Output is correct |
23 |
Correct |
4 ms |
9816 KB |
Output is correct |
24 |
Correct |
6 ms |
9756 KB |
Output is correct |
25 |
Correct |
5 ms |
9816 KB |
Output is correct |
26 |
Correct |
5 ms |
9816 KB |
Output is correct |
27 |
Correct |
4 ms |
9816 KB |
Output is correct |
28 |
Correct |
4 ms |
9816 KB |
Output is correct |
29 |
Correct |
5 ms |
9816 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
9816 KB |
Output is correct |
2 |
Correct |
4 ms |
9816 KB |
Output is correct |
3 |
Correct |
4 ms |
9816 KB |
Output is correct |
4 |
Correct |
5 ms |
9816 KB |
Output is correct |
5 |
Correct |
4 ms |
9816 KB |
Output is correct |
6 |
Correct |
3 ms |
9816 KB |
Output is correct |
7 |
Correct |
4 ms |
9816 KB |
Output is correct |
8 |
Correct |
5 ms |
9816 KB |
Output is correct |
9 |
Correct |
4 ms |
9816 KB |
Output is correct |
10 |
Correct |
4 ms |
9816 KB |
Output is correct |
11 |
Correct |
4 ms |
9816 KB |
Output is correct |
12 |
Correct |
4 ms |
9816 KB |
Output is correct |
13 |
Correct |
4 ms |
9816 KB |
Output is correct |
14 |
Correct |
5 ms |
9816 KB |
Output is correct |
15 |
Correct |
6 ms |
10072 KB |
Output is correct |
16 |
Correct |
4 ms |
9816 KB |
Output is correct |
17 |
Correct |
4 ms |
9816 KB |
Output is correct |
18 |
Correct |
4 ms |
9816 KB |
Output is correct |
19 |
Correct |
4 ms |
9816 KB |
Output is correct |
20 |
Correct |
4 ms |
9816 KB |
Output is correct |
21 |
Correct |
4 ms |
9816 KB |
Output is correct |
22 |
Correct |
4 ms |
9816 KB |
Output is correct |
23 |
Correct |
4 ms |
9816 KB |
Output is correct |
24 |
Correct |
6 ms |
9756 KB |
Output is correct |
25 |
Correct |
5 ms |
9816 KB |
Output is correct |
26 |
Correct |
5 ms |
9816 KB |
Output is correct |
27 |
Correct |
4 ms |
9816 KB |
Output is correct |
28 |
Correct |
4 ms |
9816 KB |
Output is correct |
29 |
Correct |
5 ms |
9816 KB |
Output is correct |
30 |
Correct |
18 ms |
11472 KB |
Output is correct |
31 |
Correct |
6 ms |
10444 KB |
Output is correct |
32 |
Correct |
16 ms |
12632 KB |
Output is correct |
33 |
Correct |
15 ms |
11864 KB |
Output is correct |
34 |
Correct |
1002 ms |
13240 KB |
Output is correct |
35 |
Correct |
367 ms |
12464 KB |
Output is correct |
36 |
Correct |
25 ms |
11856 KB |
Output is correct |
37 |
Correct |
22 ms |
11864 KB |
Output is correct |
38 |
Correct |
23 ms |
11608 KB |
Output is correct |
39 |
Correct |
22 ms |
11700 KB |
Output is correct |
40 |
Correct |
842 ms |
13144 KB |
Output is correct |
41 |
Correct |
161 ms |
11856 KB |
Output is correct |
42 |
Correct |
112 ms |
11856 KB |
Output is correct |
43 |
Correct |
33 ms |
13392 KB |
Output is correct |
44 |
Correct |
676 ms |
13392 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
9816 KB |
Output is correct |
2 |
Correct |
4 ms |
9816 KB |
Output is correct |
3 |
Correct |
4 ms |
9816 KB |
Output is correct |
4 |
Correct |
5 ms |
9816 KB |
Output is correct |
5 |
Correct |
4 ms |
9816 KB |
Output is correct |
6 |
Correct |
3 ms |
9816 KB |
Output is correct |
7 |
Correct |
4 ms |
9816 KB |
Output is correct |
8 |
Correct |
5 ms |
9816 KB |
Output is correct |
9 |
Correct |
4 ms |
9816 KB |
Output is correct |
10 |
Correct |
4 ms |
9816 KB |
Output is correct |
11 |
Correct |
4 ms |
9816 KB |
Output is correct |
12 |
Correct |
4 ms |
9816 KB |
Output is correct |
13 |
Correct |
4 ms |
9816 KB |
Output is correct |
14 |
Correct |
5 ms |
9816 KB |
Output is correct |
15 |
Correct |
6 ms |
10072 KB |
Output is correct |
16 |
Correct |
4 ms |
9816 KB |
Output is correct |
17 |
Correct |
4 ms |
9816 KB |
Output is correct |
18 |
Correct |
4 ms |
9816 KB |
Output is correct |
19 |
Correct |
4 ms |
9816 KB |
Output is correct |
20 |
Correct |
4 ms |
9816 KB |
Output is correct |
21 |
Correct |
4 ms |
9816 KB |
Output is correct |
22 |
Correct |
4 ms |
9816 KB |
Output is correct |
23 |
Correct |
4 ms |
9816 KB |
Output is correct |
24 |
Correct |
6 ms |
9756 KB |
Output is correct |
25 |
Correct |
5 ms |
9816 KB |
Output is correct |
26 |
Correct |
5 ms |
9816 KB |
Output is correct |
27 |
Correct |
4 ms |
9816 KB |
Output is correct |
28 |
Correct |
4 ms |
9816 KB |
Output is correct |
29 |
Correct |
5 ms |
9816 KB |
Output is correct |
30 |
Correct |
18 ms |
11472 KB |
Output is correct |
31 |
Correct |
6 ms |
10444 KB |
Output is correct |
32 |
Correct |
16 ms |
12632 KB |
Output is correct |
33 |
Correct |
15 ms |
11864 KB |
Output is correct |
34 |
Correct |
1002 ms |
13240 KB |
Output is correct |
35 |
Correct |
367 ms |
12464 KB |
Output is correct |
36 |
Correct |
25 ms |
11856 KB |
Output is correct |
37 |
Correct |
22 ms |
11864 KB |
Output is correct |
38 |
Correct |
23 ms |
11608 KB |
Output is correct |
39 |
Correct |
22 ms |
11700 KB |
Output is correct |
40 |
Correct |
842 ms |
13144 KB |
Output is correct |
41 |
Correct |
161 ms |
11856 KB |
Output is correct |
42 |
Correct |
112 ms |
11856 KB |
Output is correct |
43 |
Correct |
33 ms |
13392 KB |
Output is correct |
44 |
Correct |
676 ms |
13392 KB |
Output is correct |
45 |
Runtime error |
8 ms |
19544 KB |
Execution killed with signal 11 |
46 |
Halted |
0 ms |
0 KB |
- |