Submission #711232

# Submission time Handle Problem Language Result Execution time Memory
711232 2023-03-16T10:49:24 Z Astrayt Game (APIO22_game) C++17
100 / 100
1575 ms 149068 KB
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pb push_back
#define maxn 300005
 
int N, K, L[maxn], R[maxn], fin = 0;
vector<int> adj[maxn], rev[maxn];
 
void init(int n, int k){
    N = n, K = k;
    for(int i = 0; i < K - 1; ++i) adj[i].pb(i + 1), rev[i + 1].pb(i);
    for(int i = 0; i < K; ++i) L[i] = R[i] = i;
    for(int i = K; i < n; ++i) L[i] = -1, R[i] = K;
}

void update(int u, int v){
    if(L[u] >= R[v]) {
        fin = 1;
        return;
    }   
    int midu = (L[u] + R[u]) >> 1, midv = (L[v] + R[v]) >> 1;
    if(L[u] > midv) {
        L[v] = midv + 1;
        for(auto x:adj[v]) update(v, x);
        for(auto x:rev[v]) update(x, v);
    }
    if(R[v] <= midu){
        R[u] = midu;
        for(auto x:adj[u]) update(u, x);
        for(auto x:rev[u]) update(x, u);
    }
}
 
int add_teleporter(int u, int v){
    if(u == v){
        if(u < K) return 1;
        return 0;
    }
    adj[u].pb(v);
    rev[v].pb(u);
    update(u, v);
    return fin;
}
# 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 14396 KB Output is correct
4 Correct 8 ms 14288 KB Output is correct
5 Correct 7 ms 14288 KB Output is correct
6 Correct 8 ms 14416 KB Output is correct
7 Correct 8 ms 14364 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 14396 KB Output is correct
4 Correct 8 ms 14288 KB Output is correct
5 Correct 7 ms 14288 KB Output is correct
6 Correct 8 ms 14416 KB Output is correct
7 Correct 8 ms 14364 KB Output is correct
8 Correct 7 ms 14288 KB Output is correct
9 Correct 7 ms 14288 KB Output is correct
10 Correct 7 ms 14288 KB Output is correct
11 Correct 8 ms 14288 KB Output is correct
12 Correct 8 ms 14416 KB Output is correct
13 Correct 8 ms 14288 KB Output is correct
14 Correct 7 ms 14412 KB Output is correct
15 Correct 8 ms 14288 KB Output is correct
16 Correct 8 ms 14416 KB Output is correct
17 Correct 8 ms 14288 KB Output is correct
18 Correct 8 ms 14440 KB Output is correct
19 Correct 7 ms 14416 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 14396 KB Output is correct
4 Correct 8 ms 14288 KB Output is correct
5 Correct 7 ms 14288 KB Output is correct
6 Correct 8 ms 14416 KB Output is correct
7 Correct 8 ms 14364 KB Output is correct
8 Correct 7 ms 14288 KB Output is correct
9 Correct 7 ms 14288 KB Output is correct
10 Correct 7 ms 14288 KB Output is correct
11 Correct 8 ms 14288 KB Output is correct
12 Correct 8 ms 14416 KB Output is correct
13 Correct 8 ms 14288 KB Output is correct
14 Correct 7 ms 14412 KB Output is correct
15 Correct 8 ms 14288 KB Output is correct
16 Correct 8 ms 14416 KB Output is correct
17 Correct 8 ms 14288 KB Output is correct
18 Correct 8 ms 14440 KB Output is correct
19 Correct 7 ms 14416 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 14548 KB Output is correct
23 Correct 11 ms 14508 KB Output is correct
24 Correct 9 ms 14544 KB Output is correct
25 Correct 9 ms 14544 KB Output is correct
26 Correct 10 ms 14416 KB Output is correct
27 Correct 9 ms 14416 KB Output is correct
28 Correct 9 ms 14544 KB Output is correct
29 Correct 10 ms 14544 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 14396 KB Output is correct
4 Correct 8 ms 14288 KB Output is correct
5 Correct 7 ms 14288 KB Output is correct
6 Correct 8 ms 14416 KB Output is correct
7 Correct 8 ms 14364 KB Output is correct
8 Correct 7 ms 14288 KB Output is correct
9 Correct 7 ms 14288 KB Output is correct
10 Correct 7 ms 14288 KB Output is correct
11 Correct 8 ms 14288 KB Output is correct
12 Correct 8 ms 14416 KB Output is correct
13 Correct 8 ms 14288 KB Output is correct
14 Correct 7 ms 14412 KB Output is correct
15 Correct 8 ms 14288 KB Output is correct
16 Correct 8 ms 14416 KB Output is correct
17 Correct 8 ms 14288 KB Output is correct
18 Correct 8 ms 14440 KB Output is correct
19 Correct 7 ms 14416 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 14548 KB Output is correct
23 Correct 11 ms 14508 KB Output is correct
24 Correct 9 ms 14544 KB Output is correct
25 Correct 9 ms 14544 KB Output is correct
26 Correct 10 ms 14416 KB Output is correct
27 Correct 9 ms 14416 KB Output is correct
28 Correct 9 ms 14544 KB Output is correct
29 Correct 10 ms 14544 KB Output is correct
30 Correct 24 ms 15672 KB Output is correct
31 Correct 12 ms 15008 KB Output is correct
32 Correct 33 ms 24776 KB Output is correct
33 Correct 26 ms 16456 KB Output is correct
34 Correct 56 ms 32852 KB Output is correct
35 Correct 47 ms 18344 KB Output is correct
36 Correct 49 ms 16560 KB Output is correct
37 Correct 46 ms 16436 KB Output is correct
38 Correct 44 ms 16272 KB Output is correct
39 Correct 37 ms 16304 KB Output is correct
40 Correct 65 ms 38760 KB Output is correct
41 Correct 48 ms 18504 KB Output is correct
42 Correct 41 ms 19372 KB Output is correct
43 Correct 56 ms 17936 KB Output is correct
44 Correct 56 ms 17908 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 14396 KB Output is correct
4 Correct 8 ms 14288 KB Output is correct
5 Correct 7 ms 14288 KB Output is correct
6 Correct 8 ms 14416 KB Output is correct
7 Correct 8 ms 14364 KB Output is correct
8 Correct 7 ms 14288 KB Output is correct
9 Correct 7 ms 14288 KB Output is correct
10 Correct 7 ms 14288 KB Output is correct
11 Correct 8 ms 14288 KB Output is correct
12 Correct 8 ms 14416 KB Output is correct
13 Correct 8 ms 14288 KB Output is correct
14 Correct 7 ms 14412 KB Output is correct
15 Correct 8 ms 14288 KB Output is correct
16 Correct 8 ms 14416 KB Output is correct
17 Correct 8 ms 14288 KB Output is correct
18 Correct 8 ms 14440 KB Output is correct
19 Correct 7 ms 14416 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 14548 KB Output is correct
23 Correct 11 ms 14508 KB Output is correct
24 Correct 9 ms 14544 KB Output is correct
25 Correct 9 ms 14544 KB Output is correct
26 Correct 10 ms 14416 KB Output is correct
27 Correct 9 ms 14416 KB Output is correct
28 Correct 9 ms 14544 KB Output is correct
29 Correct 10 ms 14544 KB Output is correct
30 Correct 24 ms 15672 KB Output is correct
31 Correct 12 ms 15008 KB Output is correct
32 Correct 33 ms 24776 KB Output is correct
33 Correct 26 ms 16456 KB Output is correct
34 Correct 56 ms 32852 KB Output is correct
35 Correct 47 ms 18344 KB Output is correct
36 Correct 49 ms 16560 KB Output is correct
37 Correct 46 ms 16436 KB Output is correct
38 Correct 44 ms 16272 KB Output is correct
39 Correct 37 ms 16304 KB Output is correct
40 Correct 65 ms 38760 KB Output is correct
41 Correct 48 ms 18504 KB Output is correct
42 Correct 41 ms 19372 KB Output is correct
43 Correct 56 ms 17936 KB Output is correct
44 Correct 56 ms 17908 KB Output is correct
45 Correct 247 ms 28232 KB Output is correct
46 Correct 15 ms 17164 KB Output is correct
47 Correct 15 ms 17144 KB Output is correct
48 Correct 369 ms 47600 KB Output is correct
49 Correct 275 ms 35556 KB Output is correct
50 Correct 683 ms 149068 KB Output is correct
51 Correct 952 ms 71408 KB Output is correct
52 Correct 628 ms 35444 KB Output is correct
53 Correct 791 ms 35852 KB Output is correct
54 Correct 869 ms 36036 KB Output is correct
55 Correct 1192 ms 37196 KB Output is correct
56 Correct 1436 ms 36504 KB Output is correct
57 Correct 603 ms 35724 KB Output is correct
58 Correct 710 ms 35984 KB Output is correct
59 Correct 603 ms 36020 KB Output is correct
60 Correct 746 ms 36160 KB Output is correct
61 Correct 893 ms 36004 KB Output is correct
62 Correct 583 ms 46544 KB Output is correct
63 Correct 469 ms 43368 KB Output is correct
64 Correct 1415 ms 78408 KB Output is correct
65 Correct 559 ms 49812 KB Output is correct
66 Correct 480 ms 35088 KB Output is correct
67 Correct 881 ms 71428 KB Output is correct
68 Correct 242 ms 29524 KB Output is correct
69 Correct 64 ms 23584 KB Output is correct
70 Correct 914 ms 48552 KB Output is correct
71 Correct 347 ms 30348 KB Output is correct
72 Correct 246 ms 26304 KB Output is correct
73 Correct 700 ms 45724 KB Output is correct
74 Correct 1575 ms 36648 KB Output is correct
75 Correct 1085 ms 50120 KB Output is correct
76 Correct 1188 ms 59132 KB Output is correct