# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
822178 |
2023-08-12T01:56:23 Z |
Hanksburger |
Game (APIO22_game) |
C++17 |
|
1489 ms |
83316 KB |
#include "game.h"
#include <bits/stdc++.h>
using namespace std;
vector<int> adj[300005], radj[300005];
int l[300005], r[300005];
void init(int n, int k)
{
for (int i=0; i<k; i++)
l[i]=i+1, r[i]=i+1;
for (int i=k; i<n; i++)
l[i]=0, r[i]=k+2;
}
int recur(int u, int v)
{
if (l[u]>=r[v])
return 1;
int midu=(l[u]+r[u])/2, midv=(l[v]+r[v])/2;
while (l[u]>midv)
{
l[v]=midv+1;
midv=(l[v]+r[v])/2;
if (l[u]<=midv)
for (int w:adj[v])
if (recur(v, w))
return 1;
}
while (r[v]<=midu)
{
r[u]=midu;
midu=(l[u]+r[u])/2;
if (r[v]>midu)
for (int w:radj[u])
if (recur(w, u))
return 1;
}
return 0;
}
int add_teleporter(int u, int v)
{
adj[u].push_back(v), radj[v].push_back(u);
return recur(u, v);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
10 ms |
14288 KB |
Output is correct |
2 |
Correct |
9 ms |
14300 KB |
Output is correct |
3 |
Correct |
7 ms |
14288 KB |
Output is correct |
4 |
Correct |
10 ms |
14288 KB |
Output is correct |
5 |
Correct |
10 ms |
14288 KB |
Output is correct |
6 |
Correct |
7 ms |
14404 KB |
Output is correct |
7 |
Correct |
8 ms |
14288 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
10 ms |
14288 KB |
Output is correct |
2 |
Correct |
9 ms |
14300 KB |
Output is correct |
3 |
Correct |
7 ms |
14288 KB |
Output is correct |
4 |
Correct |
10 ms |
14288 KB |
Output is correct |
5 |
Correct |
10 ms |
14288 KB |
Output is correct |
6 |
Correct |
7 ms |
14404 KB |
Output is correct |
7 |
Correct |
8 ms |
14288 KB |
Output is correct |
8 |
Correct |
8 ms |
14288 KB |
Output is correct |
9 |
Correct |
8 ms |
14288 KB |
Output is correct |
10 |
Correct |
7 ms |
14344 KB |
Output is correct |
11 |
Correct |
7 ms |
14288 KB |
Output is correct |
12 |
Correct |
9 ms |
14288 KB |
Output is correct |
13 |
Correct |
7 ms |
14288 KB |
Output is correct |
14 |
Correct |
7 ms |
14288 KB |
Output is correct |
15 |
Correct |
7 ms |
14400 KB |
Output is correct |
16 |
Correct |
7 ms |
14412 KB |
Output is correct |
17 |
Correct |
9 ms |
14304 KB |
Output is correct |
18 |
Correct |
9 ms |
14408 KB |
Output is correct |
19 |
Correct |
7 ms |
14288 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
10 ms |
14288 KB |
Output is correct |
2 |
Correct |
9 ms |
14300 KB |
Output is correct |
3 |
Correct |
7 ms |
14288 KB |
Output is correct |
4 |
Correct |
10 ms |
14288 KB |
Output is correct |
5 |
Correct |
10 ms |
14288 KB |
Output is correct |
6 |
Correct |
7 ms |
14404 KB |
Output is correct |
7 |
Correct |
8 ms |
14288 KB |
Output is correct |
8 |
Correct |
8 ms |
14288 KB |
Output is correct |
9 |
Correct |
8 ms |
14288 KB |
Output is correct |
10 |
Correct |
7 ms |
14344 KB |
Output is correct |
11 |
Correct |
7 ms |
14288 KB |
Output is correct |
12 |
Correct |
9 ms |
14288 KB |
Output is correct |
13 |
Correct |
7 ms |
14288 KB |
Output is correct |
14 |
Correct |
7 ms |
14288 KB |
Output is correct |
15 |
Correct |
7 ms |
14400 KB |
Output is correct |
16 |
Correct |
7 ms |
14412 KB |
Output is correct |
17 |
Correct |
9 ms |
14304 KB |
Output is correct |
18 |
Correct |
9 ms |
14408 KB |
Output is correct |
19 |
Correct |
7 ms |
14288 KB |
Output is correct |
20 |
Correct |
8 ms |
14416 KB |
Output is correct |
21 |
Correct |
7 ms |
14416 KB |
Output is correct |
22 |
Correct |
8 ms |
14396 KB |
Output is correct |
23 |
Correct |
9 ms |
14436 KB |
Output is correct |
24 |
Correct |
10 ms |
14496 KB |
Output is correct |
25 |
Correct |
12 ms |
14516 KB |
Output is correct |
26 |
Correct |
8 ms |
14416 KB |
Output is correct |
27 |
Correct |
9 ms |
14444 KB |
Output is correct |
28 |
Correct |
10 ms |
14536 KB |
Output is correct |
29 |
Correct |
11 ms |
14564 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
10 ms |
14288 KB |
Output is correct |
2 |
Correct |
9 ms |
14300 KB |
Output is correct |
3 |
Correct |
7 ms |
14288 KB |
Output is correct |
4 |
Correct |
10 ms |
14288 KB |
Output is correct |
5 |
Correct |
10 ms |
14288 KB |
Output is correct |
6 |
Correct |
7 ms |
14404 KB |
Output is correct |
7 |
Correct |
8 ms |
14288 KB |
Output is correct |
8 |
Correct |
8 ms |
14288 KB |
Output is correct |
9 |
Correct |
8 ms |
14288 KB |
Output is correct |
10 |
Correct |
7 ms |
14344 KB |
Output is correct |
11 |
Correct |
7 ms |
14288 KB |
Output is correct |
12 |
Correct |
9 ms |
14288 KB |
Output is correct |
13 |
Correct |
7 ms |
14288 KB |
Output is correct |
14 |
Correct |
7 ms |
14288 KB |
Output is correct |
15 |
Correct |
7 ms |
14400 KB |
Output is correct |
16 |
Correct |
7 ms |
14412 KB |
Output is correct |
17 |
Correct |
9 ms |
14304 KB |
Output is correct |
18 |
Correct |
9 ms |
14408 KB |
Output is correct |
19 |
Correct |
7 ms |
14288 KB |
Output is correct |
20 |
Correct |
8 ms |
14416 KB |
Output is correct |
21 |
Correct |
7 ms |
14416 KB |
Output is correct |
22 |
Correct |
8 ms |
14396 KB |
Output is correct |
23 |
Correct |
9 ms |
14436 KB |
Output is correct |
24 |
Correct |
10 ms |
14496 KB |
Output is correct |
25 |
Correct |
12 ms |
14516 KB |
Output is correct |
26 |
Correct |
8 ms |
14416 KB |
Output is correct |
27 |
Correct |
9 ms |
14444 KB |
Output is correct |
28 |
Correct |
10 ms |
14536 KB |
Output is correct |
29 |
Correct |
11 ms |
14564 KB |
Output is correct |
30 |
Correct |
21 ms |
15740 KB |
Output is correct |
31 |
Correct |
13 ms |
15112 KB |
Output is correct |
32 |
Correct |
32 ms |
18120 KB |
Output is correct |
33 |
Correct |
26 ms |
16428 KB |
Output is correct |
34 |
Correct |
39 ms |
22696 KB |
Output is correct |
35 |
Correct |
35 ms |
18680 KB |
Output is correct |
36 |
Correct |
44 ms |
16628 KB |
Output is correct |
37 |
Correct |
34 ms |
16432 KB |
Output is correct |
38 |
Correct |
30 ms |
16168 KB |
Output is correct |
39 |
Correct |
31 ms |
16296 KB |
Output is correct |
40 |
Correct |
41 ms |
22324 KB |
Output is correct |
41 |
Correct |
29 ms |
17896 KB |
Output is correct |
42 |
Correct |
35 ms |
16408 KB |
Output is correct |
43 |
Correct |
35 ms |
18172 KB |
Output is correct |
44 |
Correct |
55 ms |
18052 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
10 ms |
14288 KB |
Output is correct |
2 |
Correct |
9 ms |
14300 KB |
Output is correct |
3 |
Correct |
7 ms |
14288 KB |
Output is correct |
4 |
Correct |
10 ms |
14288 KB |
Output is correct |
5 |
Correct |
10 ms |
14288 KB |
Output is correct |
6 |
Correct |
7 ms |
14404 KB |
Output is correct |
7 |
Correct |
8 ms |
14288 KB |
Output is correct |
8 |
Correct |
8 ms |
14288 KB |
Output is correct |
9 |
Correct |
8 ms |
14288 KB |
Output is correct |
10 |
Correct |
7 ms |
14344 KB |
Output is correct |
11 |
Correct |
7 ms |
14288 KB |
Output is correct |
12 |
Correct |
9 ms |
14288 KB |
Output is correct |
13 |
Correct |
7 ms |
14288 KB |
Output is correct |
14 |
Correct |
7 ms |
14288 KB |
Output is correct |
15 |
Correct |
7 ms |
14400 KB |
Output is correct |
16 |
Correct |
7 ms |
14412 KB |
Output is correct |
17 |
Correct |
9 ms |
14304 KB |
Output is correct |
18 |
Correct |
9 ms |
14408 KB |
Output is correct |
19 |
Correct |
7 ms |
14288 KB |
Output is correct |
20 |
Correct |
8 ms |
14416 KB |
Output is correct |
21 |
Correct |
7 ms |
14416 KB |
Output is correct |
22 |
Correct |
8 ms |
14396 KB |
Output is correct |
23 |
Correct |
9 ms |
14436 KB |
Output is correct |
24 |
Correct |
10 ms |
14496 KB |
Output is correct |
25 |
Correct |
12 ms |
14516 KB |
Output is correct |
26 |
Correct |
8 ms |
14416 KB |
Output is correct |
27 |
Correct |
9 ms |
14444 KB |
Output is correct |
28 |
Correct |
10 ms |
14536 KB |
Output is correct |
29 |
Correct |
11 ms |
14564 KB |
Output is correct |
30 |
Correct |
21 ms |
15740 KB |
Output is correct |
31 |
Correct |
13 ms |
15112 KB |
Output is correct |
32 |
Correct |
32 ms |
18120 KB |
Output is correct |
33 |
Correct |
26 ms |
16428 KB |
Output is correct |
34 |
Correct |
39 ms |
22696 KB |
Output is correct |
35 |
Correct |
35 ms |
18680 KB |
Output is correct |
36 |
Correct |
44 ms |
16628 KB |
Output is correct |
37 |
Correct |
34 ms |
16432 KB |
Output is correct |
38 |
Correct |
30 ms |
16168 KB |
Output is correct |
39 |
Correct |
31 ms |
16296 KB |
Output is correct |
40 |
Correct |
41 ms |
22324 KB |
Output is correct |
41 |
Correct |
29 ms |
17896 KB |
Output is correct |
42 |
Correct |
35 ms |
16408 KB |
Output is correct |
43 |
Correct |
35 ms |
18172 KB |
Output is correct |
44 |
Correct |
55 ms |
18052 KB |
Output is correct |
45 |
Correct |
234 ms |
28072 KB |
Output is correct |
46 |
Correct |
12 ms |
17160 KB |
Output is correct |
47 |
Correct |
16 ms |
17012 KB |
Output is correct |
48 |
Correct |
369 ms |
49508 KB |
Output is correct |
49 |
Correct |
315 ms |
35520 KB |
Output is correct |
50 |
Correct |
831 ms |
64288 KB |
Output is correct |
51 |
Correct |
895 ms |
51332 KB |
Output is correct |
52 |
Correct |
548 ms |
35468 KB |
Output is correct |
53 |
Correct |
679 ms |
35912 KB |
Output is correct |
54 |
Correct |
919 ms |
35600 KB |
Output is correct |
55 |
Correct |
1081 ms |
35824 KB |
Output is correct |
56 |
Correct |
1288 ms |
36164 KB |
Output is correct |
57 |
Correct |
500 ms |
29356 KB |
Output is correct |
58 |
Correct |
500 ms |
29448 KB |
Output is correct |
59 |
Correct |
497 ms |
29592 KB |
Output is correct |
60 |
Correct |
531 ms |
29540 KB |
Output is correct |
61 |
Correct |
433 ms |
29452 KB |
Output is correct |
62 |
Correct |
527 ms |
46492 KB |
Output is correct |
63 |
Correct |
464 ms |
43152 KB |
Output is correct |
64 |
Correct |
1264 ms |
83316 KB |
Output is correct |
65 |
Correct |
506 ms |
39720 KB |
Output is correct |
66 |
Correct |
339 ms |
35636 KB |
Output is correct |
67 |
Correct |
561 ms |
45704 KB |
Output is correct |
68 |
Correct |
218 ms |
26292 KB |
Output is correct |
69 |
Correct |
43 ms |
20264 KB |
Output is correct |
70 |
Correct |
835 ms |
46312 KB |
Output is correct |
71 |
Correct |
260 ms |
29060 KB |
Output is correct |
72 |
Correct |
243 ms |
24880 KB |
Output is correct |
73 |
Correct |
784 ms |
41780 KB |
Output is correct |
74 |
Correct |
1489 ms |
35600 KB |
Output is correct |
75 |
Correct |
1168 ms |
51684 KB |
Output is correct |
76 |
Correct |
1309 ms |
73952 KB |
Output is correct |