Submission #979996

# Submission time Handle Problem Language Result Execution time Memory
979996 2024-05-11T19:04:50 Z avita Game (APIO22_game) C++17
100 / 100
1261 ms 64520 KB
#include "game.h"
#include<bits/stdc++.h>
using namespace std;
 
const int maxn=300005;
int n, k, ok, l[maxn], r[maxn], layer[maxn];
vector <int> A[maxn], At[maxn];
 
void propagate(int u)
{
    if (ok) return;
    if (r[u]<=l[u]) return ok=1, void();
    int j=__lg(l[u]^r[u]);
    if (layer[u]>j) layer[u]=j; 
    else return;
    for (int v:A[u]) l[v]=max(l[v], l[u]), propagate(v);
    for (int v:At[u]) r[v]=min(r[v], r[u]), propagate(v);
}
 
int add_teleporter(int u, int v)
{
    A[u].push_back(v), At[v].push_back(u);
    l[v]=max(l[v], max(l[u], u<k?u:-1)), propagate(v);
    r[u]=min(r[u], min(r[v], v<k?v:k)), propagate(u);
    return ok;
}
 
void init(int N, int K)
{
    n=N, k=K;
    for (int i=0; i<k; i++) l[i]=i, r[i]=i+1;
    for (int i=k; i<n; i++) l[i]=-1, r[i]=k;
    for (int i=0; i<n; i++) layer[i]=__lg(l[i]^r[i]);
}
/*int main()
{
    
}*/
# Verdict Execution time Memory Grader output
1 Correct 3 ms 16984 KB Output is correct
2 Correct 5 ms 17008 KB Output is correct
3 Correct 5 ms 17012 KB Output is correct
4 Correct 3 ms 16984 KB Output is correct
5 Correct 4 ms 16984 KB Output is correct
6 Correct 4 ms 16984 KB Output is correct
7 Correct 4 ms 16984 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 16984 KB Output is correct
2 Correct 5 ms 17008 KB Output is correct
3 Correct 5 ms 17012 KB Output is correct
4 Correct 3 ms 16984 KB Output is correct
5 Correct 4 ms 16984 KB Output is correct
6 Correct 4 ms 16984 KB Output is correct
7 Correct 4 ms 16984 KB Output is correct
8 Correct 3 ms 16984 KB Output is correct
9 Correct 3 ms 16984 KB Output is correct
10 Correct 4 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 3 ms 16984 KB Output is correct
14 Correct 4 ms 16984 KB Output is correct
15 Correct 4 ms 17024 KB Output is correct
16 Correct 4 ms 16984 KB Output is correct
17 Correct 5 ms 16984 KB Output is correct
18 Correct 3 ms 16984 KB Output is correct
19 Correct 4 ms 16984 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 16984 KB Output is correct
2 Correct 5 ms 17008 KB Output is correct
3 Correct 5 ms 17012 KB Output is correct
4 Correct 3 ms 16984 KB Output is correct
5 Correct 4 ms 16984 KB Output is correct
6 Correct 4 ms 16984 KB Output is correct
7 Correct 4 ms 16984 KB Output is correct
8 Correct 3 ms 16984 KB Output is correct
9 Correct 3 ms 16984 KB Output is correct
10 Correct 4 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 3 ms 16984 KB Output is correct
14 Correct 4 ms 16984 KB Output is correct
15 Correct 4 ms 17024 KB Output is correct
16 Correct 4 ms 16984 KB Output is correct
17 Correct 5 ms 16984 KB Output is correct
18 Correct 3 ms 16984 KB Output is correct
19 Correct 4 ms 16984 KB Output is correct
20 Correct 4 ms 16984 KB Output is correct
21 Correct 3 ms 16984 KB Output is correct
22 Correct 4 ms 16984 KB Output is correct
23 Correct 4 ms 16984 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 16984 KB Output is correct
27 Correct 5 ms 16984 KB Output is correct
28 Correct 4 ms 16984 KB Output is correct
29 Correct 4 ms 16984 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 16984 KB Output is correct
2 Correct 5 ms 17008 KB Output is correct
3 Correct 5 ms 17012 KB Output is correct
4 Correct 3 ms 16984 KB Output is correct
5 Correct 4 ms 16984 KB Output is correct
6 Correct 4 ms 16984 KB Output is correct
7 Correct 4 ms 16984 KB Output is correct
8 Correct 3 ms 16984 KB Output is correct
9 Correct 3 ms 16984 KB Output is correct
10 Correct 4 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 3 ms 16984 KB Output is correct
14 Correct 4 ms 16984 KB Output is correct
15 Correct 4 ms 17024 KB Output is correct
16 Correct 4 ms 16984 KB Output is correct
17 Correct 5 ms 16984 KB Output is correct
18 Correct 3 ms 16984 KB Output is correct
19 Correct 4 ms 16984 KB Output is correct
20 Correct 4 ms 16984 KB Output is correct
21 Correct 3 ms 16984 KB Output is correct
22 Correct 4 ms 16984 KB Output is correct
23 Correct 4 ms 16984 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 16984 KB Output is correct
27 Correct 5 ms 16984 KB Output is correct
28 Correct 4 ms 16984 KB Output is correct
29 Correct 4 ms 16984 KB Output is correct
30 Correct 15 ms 18120 KB Output is correct
31 Correct 6 ms 17496 KB Output is correct
32 Correct 19 ms 19288 KB Output is correct
33 Correct 20 ms 19284 KB Output is correct
34 Correct 34 ms 23016 KB Output is correct
35 Correct 26 ms 20312 KB Output is correct
36 Correct 35 ms 19168 KB Output is correct
37 Correct 31 ms 19128 KB Output is correct
38 Correct 25 ms 19032 KB Output is correct
39 Correct 31 ms 19028 KB Output is correct
40 Correct 36 ms 22536 KB Output is correct
41 Correct 28 ms 19392 KB Output is correct
42 Correct 27 ms 19280 KB Output is correct
43 Correct 31 ms 20056 KB Output is correct
44 Correct 36 ms 20824 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 16984 KB Output is correct
2 Correct 5 ms 17008 KB Output is correct
3 Correct 5 ms 17012 KB Output is correct
4 Correct 3 ms 16984 KB Output is correct
5 Correct 4 ms 16984 KB Output is correct
6 Correct 4 ms 16984 KB Output is correct
7 Correct 4 ms 16984 KB Output is correct
8 Correct 3 ms 16984 KB Output is correct
9 Correct 3 ms 16984 KB Output is correct
10 Correct 4 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 3 ms 16984 KB Output is correct
14 Correct 4 ms 16984 KB Output is correct
15 Correct 4 ms 17024 KB Output is correct
16 Correct 4 ms 16984 KB Output is correct
17 Correct 5 ms 16984 KB Output is correct
18 Correct 3 ms 16984 KB Output is correct
19 Correct 4 ms 16984 KB Output is correct
20 Correct 4 ms 16984 KB Output is correct
21 Correct 3 ms 16984 KB Output is correct
22 Correct 4 ms 16984 KB Output is correct
23 Correct 4 ms 16984 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 16984 KB Output is correct
27 Correct 5 ms 16984 KB Output is correct
28 Correct 4 ms 16984 KB Output is correct
29 Correct 4 ms 16984 KB Output is correct
30 Correct 15 ms 18120 KB Output is correct
31 Correct 6 ms 17496 KB Output is correct
32 Correct 19 ms 19288 KB Output is correct
33 Correct 20 ms 19284 KB Output is correct
34 Correct 34 ms 23016 KB Output is correct
35 Correct 26 ms 20312 KB Output is correct
36 Correct 35 ms 19168 KB Output is correct
37 Correct 31 ms 19128 KB Output is correct
38 Correct 25 ms 19032 KB Output is correct
39 Correct 31 ms 19028 KB Output is correct
40 Correct 36 ms 22536 KB Output is correct
41 Correct 28 ms 19392 KB Output is correct
42 Correct 27 ms 19280 KB Output is correct
43 Correct 31 ms 20056 KB Output is correct
44 Correct 36 ms 20824 KB Output is correct
45 Correct 213 ms 29980 KB Output is correct
46 Correct 8 ms 18264 KB Output is correct
47 Correct 7 ms 18264 KB Output is correct
48 Correct 302 ms 44988 KB Output is correct
49 Correct 220 ms 37528 KB Output is correct
50 Correct 642 ms 51500 KB Output is correct
51 Correct 779 ms 45792 KB Output is correct
52 Correct 517 ms 37504 KB Output is correct
53 Correct 642 ms 37000 KB Output is correct
54 Correct 739 ms 37044 KB Output is correct
55 Correct 1030 ms 37632 KB Output is correct
56 Correct 1110 ms 36940 KB Output is correct
57 Correct 411 ms 31356 KB Output is correct
58 Correct 414 ms 31456 KB Output is correct
59 Correct 417 ms 31104 KB Output is correct
60 Correct 395 ms 31124 KB Output is correct
61 Correct 399 ms 30812 KB Output is correct
62 Correct 413 ms 41452 KB Output is correct
63 Correct 402 ms 38148 KB Output is correct
64 Correct 1261 ms 64520 KB Output is correct
65 Correct 450 ms 37824 KB Output is correct
66 Correct 381 ms 33752 KB Output is correct
67 Correct 628 ms 42992 KB Output is correct
68 Correct 177 ms 28060 KB Output is correct
69 Correct 44 ms 21992 KB Output is correct
70 Correct 641 ms 42268 KB Output is correct
71 Correct 262 ms 30908 KB Output is correct
72 Correct 197 ms 27044 KB Output is correct
73 Correct 531 ms 39552 KB Output is correct
74 Correct 1216 ms 36652 KB Output is correct
75 Correct 1070 ms 46788 KB Output is correct
76 Correct 1041 ms 54440 KB Output is correct