Submission #710357

# Submission time Handle Problem Language Result Execution time Memory
710357 2023-03-15T07:38:46 Z Astrayt Game (APIO22_game) C++17
60 / 100
4000 ms 34364 KB
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pb push_back
#define maxn 300005

int N, K, low[maxn];
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 < n; ++i) low[i] = i;
}

int add_teleporter(int u, int v){
    if(u == v){
        if(u < K) return 1;
        else return 0;
    }
    adj[u].pb(v);
    rev[v].pb(u);
    queue<int> bfs; bfs.push(v);
    while(bfs.size()){
        int a = bfs.front(); bfs.pop();
        for(auto b:rev[a]){
            if(b == low[a] && b < K) return 1;
            if(low[b] > low[a]) {
                low[b] = low[a];
                bfs.push(b);
            }
        }
    }
    for(int i = 0; i < K; ++i){
        if(low[i] < i) return 1;
    }
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 8 ms 14288 KB Output is correct
2 Correct 8 ms 14276 KB Output is correct
3 Correct 9 ms 14288 KB Output is correct
4 Correct 7 ms 14288 KB Output is correct
5 Correct 7 ms 14288 KB Output is correct
6 Correct 8 ms 14408 KB Output is correct
7 Correct 9 ms 14288 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 8 ms 14288 KB Output is correct
2 Correct 8 ms 14276 KB Output is correct
3 Correct 9 ms 14288 KB Output is correct
4 Correct 7 ms 14288 KB Output is correct
5 Correct 7 ms 14288 KB Output is correct
6 Correct 8 ms 14408 KB Output is correct
7 Correct 9 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 14288 KB Output is correct
11 Correct 8 ms 14288 KB Output is correct
12 Correct 7 ms 14288 KB Output is correct
13 Correct 8 ms 14288 KB Output is correct
14 Correct 9 ms 14288 KB Output is correct
15 Correct 8 ms 14288 KB Output is correct
16 Correct 8 ms 14288 KB Output is correct
17 Correct 9 ms 14288 KB Output is correct
18 Correct 8 ms 14292 KB Output is correct
19 Correct 7 ms 14288 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 8 ms 14288 KB Output is correct
2 Correct 8 ms 14276 KB Output is correct
3 Correct 9 ms 14288 KB Output is correct
4 Correct 7 ms 14288 KB Output is correct
5 Correct 7 ms 14288 KB Output is correct
6 Correct 8 ms 14408 KB Output is correct
7 Correct 9 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 14288 KB Output is correct
11 Correct 8 ms 14288 KB Output is correct
12 Correct 7 ms 14288 KB Output is correct
13 Correct 8 ms 14288 KB Output is correct
14 Correct 9 ms 14288 KB Output is correct
15 Correct 8 ms 14288 KB Output is correct
16 Correct 8 ms 14288 KB Output is correct
17 Correct 9 ms 14288 KB Output is correct
18 Correct 8 ms 14292 KB Output is correct
19 Correct 7 ms 14288 KB Output is correct
20 Correct 8 ms 14468 KB Output is correct
21 Correct 7 ms 14288 KB Output is correct
22 Correct 8 ms 14444 KB Output is correct
23 Correct 8 ms 14376 KB Output is correct
24 Correct 11 ms 14468 KB Output is correct
25 Correct 11 ms 14444 KB Output is correct
26 Correct 12 ms 14472 KB Output is correct
27 Correct 11 ms 14468 KB Output is correct
28 Correct 10 ms 14436 KB Output is correct
29 Correct 11 ms 14436 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 8 ms 14288 KB Output is correct
2 Correct 8 ms 14276 KB Output is correct
3 Correct 9 ms 14288 KB Output is correct
4 Correct 7 ms 14288 KB Output is correct
5 Correct 7 ms 14288 KB Output is correct
6 Correct 8 ms 14408 KB Output is correct
7 Correct 9 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 14288 KB Output is correct
11 Correct 8 ms 14288 KB Output is correct
12 Correct 7 ms 14288 KB Output is correct
13 Correct 8 ms 14288 KB Output is correct
14 Correct 9 ms 14288 KB Output is correct
15 Correct 8 ms 14288 KB Output is correct
16 Correct 8 ms 14288 KB Output is correct
17 Correct 9 ms 14288 KB Output is correct
18 Correct 8 ms 14292 KB Output is correct
19 Correct 7 ms 14288 KB Output is correct
20 Correct 8 ms 14468 KB Output is correct
21 Correct 7 ms 14288 KB Output is correct
22 Correct 8 ms 14444 KB Output is correct
23 Correct 8 ms 14376 KB Output is correct
24 Correct 11 ms 14468 KB Output is correct
25 Correct 11 ms 14444 KB Output is correct
26 Correct 12 ms 14472 KB Output is correct
27 Correct 11 ms 14468 KB Output is correct
28 Correct 10 ms 14436 KB Output is correct
29 Correct 11 ms 14436 KB Output is correct
30 Correct 25 ms 15616 KB Output is correct
31 Correct 14 ms 14972 KB Output is correct
32 Correct 32 ms 16284 KB Output is correct
33 Correct 35 ms 16360 KB Output is correct
34 Correct 578 ms 16416 KB Output is correct
35 Correct 243 ms 16456 KB Output is correct
36 Correct 48 ms 16360 KB Output is correct
37 Correct 50 ms 16304 KB Output is correct
38 Correct 62 ms 16120 KB Output is correct
39 Correct 52 ms 16184 KB Output is correct
40 Correct 480 ms 16620 KB Output is correct
41 Correct 125 ms 16168 KB Output is correct
42 Correct 117 ms 16176 KB Output is correct
43 Correct 67 ms 16404 KB Output is correct
44 Correct 480 ms 16524 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 8 ms 14288 KB Output is correct
2 Correct 8 ms 14276 KB Output is correct
3 Correct 9 ms 14288 KB Output is correct
4 Correct 7 ms 14288 KB Output is correct
5 Correct 7 ms 14288 KB Output is correct
6 Correct 8 ms 14408 KB Output is correct
7 Correct 9 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 14288 KB Output is correct
11 Correct 8 ms 14288 KB Output is correct
12 Correct 7 ms 14288 KB Output is correct
13 Correct 8 ms 14288 KB Output is correct
14 Correct 9 ms 14288 KB Output is correct
15 Correct 8 ms 14288 KB Output is correct
16 Correct 8 ms 14288 KB Output is correct
17 Correct 9 ms 14288 KB Output is correct
18 Correct 8 ms 14292 KB Output is correct
19 Correct 7 ms 14288 KB Output is correct
20 Correct 8 ms 14468 KB Output is correct
21 Correct 7 ms 14288 KB Output is correct
22 Correct 8 ms 14444 KB Output is correct
23 Correct 8 ms 14376 KB Output is correct
24 Correct 11 ms 14468 KB Output is correct
25 Correct 11 ms 14444 KB Output is correct
26 Correct 12 ms 14472 KB Output is correct
27 Correct 11 ms 14468 KB Output is correct
28 Correct 10 ms 14436 KB Output is correct
29 Correct 11 ms 14436 KB Output is correct
30 Correct 25 ms 15616 KB Output is correct
31 Correct 14 ms 14972 KB Output is correct
32 Correct 32 ms 16284 KB Output is correct
33 Correct 35 ms 16360 KB Output is correct
34 Correct 578 ms 16416 KB Output is correct
35 Correct 243 ms 16456 KB Output is correct
36 Correct 48 ms 16360 KB Output is correct
37 Correct 50 ms 16304 KB Output is correct
38 Correct 62 ms 16120 KB Output is correct
39 Correct 52 ms 16184 KB Output is correct
40 Correct 480 ms 16620 KB Output is correct
41 Correct 125 ms 16168 KB Output is correct
42 Correct 117 ms 16176 KB Output is correct
43 Correct 67 ms 16404 KB Output is correct
44 Correct 480 ms 16524 KB Output is correct
45 Correct 299 ms 26828 KB Output is correct
46 Correct 20 ms 15944 KB Output is correct
47 Correct 19 ms 15956 KB Output is correct
48 Correct 520 ms 34364 KB Output is correct
49 Correct 445 ms 34280 KB Output is correct
50 Execution timed out 4102 ms 29968 KB Time limit exceeded
51 Halted 0 ms 0 KB -