# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
980889 |
2024-05-12T15:06:24 Z |
nnin |
Game (APIO22_game) |
C++17 |
|
1253 ms |
64508 KB |
#include "game.h"
#include<bits/stdc++.h>
using namespace std;
int n, k, ret;
int st[300005], en[300005], diff[300005];
vector<int> adj[300005], rev[300005];
void func(int u) {
if(st[u]>=en[u]) ret = 1;
if(ret) return;
int d = __lg(st[u]^en[u]);
if(d<diff[u]) diff[u] = d;
else return;
for(int v:adj[u]) {
st[v] = max(st[v], st[u]);
func(v);
}
for(int v:rev[u]) {
en[v] = min(en[v], en[u]);
func(v);
}
}
void init(int N, int K) {
n = N; k = K;
for(int i=0;i<k;i++) {
st[i] = i;
en[i] = i+1;
}
for(int i=k;i<n;i++) {
st[i] = -1;
en[i] = k;
}
for(int i=0;i<n;i++) {
diff[i] = __lg(st[i]^en[i]);
}
}
int add_teleporter(int u, int v) {
adj[u].push_back(v);
rev[v].push_back(u);
st[v] = max(st[v], st[u]);
en[u] = min(en[u], en[v]);
if(u<k) st[v] = max(st[v], u);
if(v<k) en[u] = min(en[u], v);
func(v);
func(u);
return ret;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
16984 KB |
Output is correct |
2 |
Correct |
5 ms |
16984 KB |
Output is correct |
3 |
Correct |
6 ms |
16984 KB |
Output is correct |
4 |
Correct |
6 ms |
16984 KB |
Output is correct |
5 |
Correct |
4 ms |
16984 KB |
Output is correct |
6 |
Correct |
3 ms |
16984 KB |
Output is correct |
7 |
Correct |
3 ms |
16984 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
16984 KB |
Output is correct |
2 |
Correct |
5 ms |
16984 KB |
Output is correct |
3 |
Correct |
6 ms |
16984 KB |
Output is correct |
4 |
Correct |
6 ms |
16984 KB |
Output is correct |
5 |
Correct |
4 ms |
16984 KB |
Output is correct |
6 |
Correct |
3 ms |
16984 KB |
Output is correct |
7 |
Correct |
3 ms |
16984 KB |
Output is correct |
8 |
Correct |
4 ms |
16984 KB |
Output is correct |
9 |
Correct |
3 ms |
16984 KB |
Output is correct |
10 |
Correct |
3 ms |
16984 KB |
Output is correct |
11 |
Correct |
4 ms |
16984 KB |
Output is correct |
12 |
Correct |
3 ms |
16984 KB |
Output is correct |
13 |
Correct |
4 ms |
16984 KB |
Output is correct |
14 |
Correct |
3 ms |
16984 KB |
Output is correct |
15 |
Correct |
4 ms |
16984 KB |
Output is correct |
16 |
Correct |
5 ms |
16984 KB |
Output is correct |
17 |
Correct |
4 ms |
16984 KB |
Output is correct |
18 |
Correct |
3 ms |
16984 KB |
Output is correct |
19 |
Correct |
4 ms |
17028 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
16984 KB |
Output is correct |
2 |
Correct |
5 ms |
16984 KB |
Output is correct |
3 |
Correct |
6 ms |
16984 KB |
Output is correct |
4 |
Correct |
6 ms |
16984 KB |
Output is correct |
5 |
Correct |
4 ms |
16984 KB |
Output is correct |
6 |
Correct |
3 ms |
16984 KB |
Output is correct |
7 |
Correct |
3 ms |
16984 KB |
Output is correct |
8 |
Correct |
4 ms |
16984 KB |
Output is correct |
9 |
Correct |
3 ms |
16984 KB |
Output is correct |
10 |
Correct |
3 ms |
16984 KB |
Output is correct |
11 |
Correct |
4 ms |
16984 KB |
Output is correct |
12 |
Correct |
3 ms |
16984 KB |
Output is correct |
13 |
Correct |
4 ms |
16984 KB |
Output is correct |
14 |
Correct |
3 ms |
16984 KB |
Output is correct |
15 |
Correct |
4 ms |
16984 KB |
Output is correct |
16 |
Correct |
5 ms |
16984 KB |
Output is correct |
17 |
Correct |
4 ms |
16984 KB |
Output is correct |
18 |
Correct |
3 ms |
16984 KB |
Output is correct |
19 |
Correct |
4 ms |
17028 KB |
Output is correct |
20 |
Correct |
4 ms |
16984 KB |
Output is correct |
21 |
Correct |
4 ms |
16984 KB |
Output is correct |
22 |
Correct |
4 ms |
16984 KB |
Output is correct |
23 |
Correct |
4 ms |
17236 KB |
Output is correct |
24 |
Correct |
4 ms |
16984 KB |
Output is correct |
25 |
Correct |
5 ms |
16984 KB |
Output is correct |
26 |
Correct |
5 ms |
17240 KB |
Output is correct |
27 |
Correct |
5 ms |
17084 KB |
Output is correct |
28 |
Correct |
4 ms |
17240 KB |
Output is correct |
29 |
Correct |
5 ms |
17240 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
16984 KB |
Output is correct |
2 |
Correct |
5 ms |
16984 KB |
Output is correct |
3 |
Correct |
6 ms |
16984 KB |
Output is correct |
4 |
Correct |
6 ms |
16984 KB |
Output is correct |
5 |
Correct |
4 ms |
16984 KB |
Output is correct |
6 |
Correct |
3 ms |
16984 KB |
Output is correct |
7 |
Correct |
3 ms |
16984 KB |
Output is correct |
8 |
Correct |
4 ms |
16984 KB |
Output is correct |
9 |
Correct |
3 ms |
16984 KB |
Output is correct |
10 |
Correct |
3 ms |
16984 KB |
Output is correct |
11 |
Correct |
4 ms |
16984 KB |
Output is correct |
12 |
Correct |
3 ms |
16984 KB |
Output is correct |
13 |
Correct |
4 ms |
16984 KB |
Output is correct |
14 |
Correct |
3 ms |
16984 KB |
Output is correct |
15 |
Correct |
4 ms |
16984 KB |
Output is correct |
16 |
Correct |
5 ms |
16984 KB |
Output is correct |
17 |
Correct |
4 ms |
16984 KB |
Output is correct |
18 |
Correct |
3 ms |
16984 KB |
Output is correct |
19 |
Correct |
4 ms |
17028 KB |
Output is correct |
20 |
Correct |
4 ms |
16984 KB |
Output is correct |
21 |
Correct |
4 ms |
16984 KB |
Output is correct |
22 |
Correct |
4 ms |
16984 KB |
Output is correct |
23 |
Correct |
4 ms |
17236 KB |
Output is correct |
24 |
Correct |
4 ms |
16984 KB |
Output is correct |
25 |
Correct |
5 ms |
16984 KB |
Output is correct |
26 |
Correct |
5 ms |
17240 KB |
Output is correct |
27 |
Correct |
5 ms |
17084 KB |
Output is correct |
28 |
Correct |
4 ms |
17240 KB |
Output is correct |
29 |
Correct |
5 ms |
17240 KB |
Output is correct |
30 |
Correct |
20 ms |
18748 KB |
Output is correct |
31 |
Correct |
6 ms |
17240 KB |
Output is correct |
32 |
Correct |
16 ms |
19352 KB |
Output is correct |
33 |
Correct |
17 ms |
19348 KB |
Output is correct |
34 |
Correct |
30 ms |
22568 KB |
Output is correct |
35 |
Correct |
34 ms |
20720 KB |
Output is correct |
36 |
Correct |
36 ms |
19380 KB |
Output is correct |
37 |
Correct |
30 ms |
19280 KB |
Output is correct |
38 |
Correct |
26 ms |
18872 KB |
Output is correct |
39 |
Correct |
26 ms |
18932 KB |
Output is correct |
40 |
Correct |
34 ms |
22964 KB |
Output is correct |
41 |
Correct |
31 ms |
19996 KB |
Output is correct |
42 |
Correct |
25 ms |
19288 KB |
Output is correct |
43 |
Correct |
29 ms |
20336 KB |
Output is correct |
44 |
Correct |
37 ms |
20820 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
16984 KB |
Output is correct |
2 |
Correct |
5 ms |
16984 KB |
Output is correct |
3 |
Correct |
6 ms |
16984 KB |
Output is correct |
4 |
Correct |
6 ms |
16984 KB |
Output is correct |
5 |
Correct |
4 ms |
16984 KB |
Output is correct |
6 |
Correct |
3 ms |
16984 KB |
Output is correct |
7 |
Correct |
3 ms |
16984 KB |
Output is correct |
8 |
Correct |
4 ms |
16984 KB |
Output is correct |
9 |
Correct |
3 ms |
16984 KB |
Output is correct |
10 |
Correct |
3 ms |
16984 KB |
Output is correct |
11 |
Correct |
4 ms |
16984 KB |
Output is correct |
12 |
Correct |
3 ms |
16984 KB |
Output is correct |
13 |
Correct |
4 ms |
16984 KB |
Output is correct |
14 |
Correct |
3 ms |
16984 KB |
Output is correct |
15 |
Correct |
4 ms |
16984 KB |
Output is correct |
16 |
Correct |
5 ms |
16984 KB |
Output is correct |
17 |
Correct |
4 ms |
16984 KB |
Output is correct |
18 |
Correct |
3 ms |
16984 KB |
Output is correct |
19 |
Correct |
4 ms |
17028 KB |
Output is correct |
20 |
Correct |
4 ms |
16984 KB |
Output is correct |
21 |
Correct |
4 ms |
16984 KB |
Output is correct |
22 |
Correct |
4 ms |
16984 KB |
Output is correct |
23 |
Correct |
4 ms |
17236 KB |
Output is correct |
24 |
Correct |
4 ms |
16984 KB |
Output is correct |
25 |
Correct |
5 ms |
16984 KB |
Output is correct |
26 |
Correct |
5 ms |
17240 KB |
Output is correct |
27 |
Correct |
5 ms |
17084 KB |
Output is correct |
28 |
Correct |
4 ms |
17240 KB |
Output is correct |
29 |
Correct |
5 ms |
17240 KB |
Output is correct |
30 |
Correct |
20 ms |
18748 KB |
Output is correct |
31 |
Correct |
6 ms |
17240 KB |
Output is correct |
32 |
Correct |
16 ms |
19352 KB |
Output is correct |
33 |
Correct |
17 ms |
19348 KB |
Output is correct |
34 |
Correct |
30 ms |
22568 KB |
Output is correct |
35 |
Correct |
34 ms |
20720 KB |
Output is correct |
36 |
Correct |
36 ms |
19380 KB |
Output is correct |
37 |
Correct |
30 ms |
19280 KB |
Output is correct |
38 |
Correct |
26 ms |
18872 KB |
Output is correct |
39 |
Correct |
26 ms |
18932 KB |
Output is correct |
40 |
Correct |
34 ms |
22964 KB |
Output is correct |
41 |
Correct |
31 ms |
19996 KB |
Output is correct |
42 |
Correct |
25 ms |
19288 KB |
Output is correct |
43 |
Correct |
29 ms |
20336 KB |
Output is correct |
44 |
Correct |
37 ms |
20820 KB |
Output is correct |
45 |
Correct |
195 ms |
29916 KB |
Output is correct |
46 |
Correct |
8 ms |
18516 KB |
Output is correct |
47 |
Correct |
9 ms |
18520 KB |
Output is correct |
48 |
Correct |
327 ms |
45756 KB |
Output is correct |
49 |
Correct |
219 ms |
37620 KB |
Output is correct |
50 |
Correct |
642 ms |
52164 KB |
Output is correct |
51 |
Correct |
811 ms |
46136 KB |
Output is correct |
52 |
Correct |
513 ms |
37196 KB |
Output is correct |
53 |
Correct |
668 ms |
37132 KB |
Output is correct |
54 |
Correct |
696 ms |
37200 KB |
Output is correct |
55 |
Correct |
999 ms |
37668 KB |
Output is correct |
56 |
Correct |
1004 ms |
37156 KB |
Output is correct |
57 |
Correct |
357 ms |
31460 KB |
Output is correct |
58 |
Correct |
388 ms |
31600 KB |
Output is correct |
59 |
Correct |
348 ms |
31420 KB |
Output is correct |
60 |
Correct |
416 ms |
31240 KB |
Output is correct |
61 |
Correct |
423 ms |
30932 KB |
Output is correct |
62 |
Correct |
427 ms |
41132 KB |
Output is correct |
63 |
Correct |
395 ms |
38216 KB |
Output is correct |
64 |
Correct |
1253 ms |
64508 KB |
Output is correct |
65 |
Correct |
390 ms |
37616 KB |
Output is correct |
66 |
Correct |
348 ms |
34256 KB |
Output is correct |
67 |
Correct |
619 ms |
43440 KB |
Output is correct |
68 |
Correct |
160 ms |
27996 KB |
Output is correct |
69 |
Correct |
41 ms |
21840 KB |
Output is correct |
70 |
Correct |
635 ms |
42440 KB |
Output is correct |
71 |
Correct |
260 ms |
30912 KB |
Output is correct |
72 |
Correct |
200 ms |
26476 KB |
Output is correct |
73 |
Correct |
473 ms |
40184 KB |
Output is correct |
74 |
Correct |
1184 ms |
36840 KB |
Output is correct |
75 |
Correct |
1091 ms |
47236 KB |
Output is correct |
76 |
Correct |
1079 ms |
55092 KB |
Output is correct |