Submission #601286

# Submission time Handle Problem Language Result Execution time Memory
601286 2022-07-21T15:21:20 Z doowey Game (APIO22_game) C++17
60 / 100
4000 ms 25020 KB
#include "game.h"
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;

#define fi first
#define se second
#define mp make_pair

int n, k;
const int N = (int)3e5 + 10;
int low[N];

void init(int _n, int _k) {
    n = _n;
    k = _k;
    for(int i = 0 ; i < n; i ++ ){
        low[i] = n + 1;
    }
}
vector<int> in[N];

bool sol = false;

void dfs(int u, int val){
    low[u]=val;
    if(u < k && low[u] <= u){
        sol = true;
    }
    if(sol) return;
    for(auto x : in[u]){
        if(low[x] > val){
            dfs(x, val);
        }
    }
}

int add_teleporter(int u, int v) {
    if(v < k){
        if(low[u] > v)
            dfs(u, v);
    }
    else{
        if(low[u] > low[v]){
            dfs(u, low[v]);
        }
    }
    in[v].push_back(u);
    return sol;
}
# Verdict Execution time Memory Grader output
1 Correct 5 ms 7248 KB Output is correct
2 Correct 4 ms 7248 KB Output is correct
3 Correct 4 ms 7348 KB Output is correct
4 Correct 4 ms 7300 KB Output is correct
5 Correct 4 ms 7248 KB Output is correct
6 Correct 4 ms 7248 KB Output is correct
7 Correct 4 ms 7352 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 7248 KB Output is correct
2 Correct 4 ms 7248 KB Output is correct
3 Correct 4 ms 7348 KB Output is correct
4 Correct 4 ms 7300 KB Output is correct
5 Correct 4 ms 7248 KB Output is correct
6 Correct 4 ms 7248 KB Output is correct
7 Correct 4 ms 7352 KB Output is correct
8 Correct 4 ms 7248 KB Output is correct
9 Correct 4 ms 7248 KB Output is correct
10 Correct 4 ms 7248 KB Output is correct
11 Correct 4 ms 7248 KB Output is correct
12 Correct 3 ms 7248 KB Output is correct
13 Correct 4 ms 7248 KB Output is correct
14 Correct 4 ms 7248 KB Output is correct
15 Correct 4 ms 7248 KB Output is correct
16 Correct 5 ms 7352 KB Output is correct
17 Correct 5 ms 7248 KB Output is correct
18 Correct 4 ms 7332 KB Output is correct
19 Correct 4 ms 7248 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 7248 KB Output is correct
2 Correct 4 ms 7248 KB Output is correct
3 Correct 4 ms 7348 KB Output is correct
4 Correct 4 ms 7300 KB Output is correct
5 Correct 4 ms 7248 KB Output is correct
6 Correct 4 ms 7248 KB Output is correct
7 Correct 4 ms 7352 KB Output is correct
8 Correct 4 ms 7248 KB Output is correct
9 Correct 4 ms 7248 KB Output is correct
10 Correct 4 ms 7248 KB Output is correct
11 Correct 4 ms 7248 KB Output is correct
12 Correct 3 ms 7248 KB Output is correct
13 Correct 4 ms 7248 KB Output is correct
14 Correct 4 ms 7248 KB Output is correct
15 Correct 4 ms 7248 KB Output is correct
16 Correct 5 ms 7352 KB Output is correct
17 Correct 5 ms 7248 KB Output is correct
18 Correct 4 ms 7332 KB Output is correct
19 Correct 4 ms 7248 KB Output is correct
20 Correct 6 ms 7248 KB Output is correct
21 Correct 4 ms 7248 KB Output is correct
22 Correct 4 ms 7344 KB Output is correct
23 Correct 5 ms 7276 KB Output is correct
24 Correct 6 ms 7356 KB Output is correct
25 Correct 7 ms 7360 KB Output is correct
26 Correct 6 ms 7360 KB Output is correct
27 Correct 7 ms 7376 KB Output is correct
28 Correct 5 ms 7360 KB Output is correct
29 Correct 7 ms 7376 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 7248 KB Output is correct
2 Correct 4 ms 7248 KB Output is correct
3 Correct 4 ms 7348 KB Output is correct
4 Correct 4 ms 7300 KB Output is correct
5 Correct 4 ms 7248 KB Output is correct
6 Correct 4 ms 7248 KB Output is correct
7 Correct 4 ms 7352 KB Output is correct
8 Correct 4 ms 7248 KB Output is correct
9 Correct 4 ms 7248 KB Output is correct
10 Correct 4 ms 7248 KB Output is correct
11 Correct 4 ms 7248 KB Output is correct
12 Correct 3 ms 7248 KB Output is correct
13 Correct 4 ms 7248 KB Output is correct
14 Correct 4 ms 7248 KB Output is correct
15 Correct 4 ms 7248 KB Output is correct
16 Correct 5 ms 7352 KB Output is correct
17 Correct 5 ms 7248 KB Output is correct
18 Correct 4 ms 7332 KB Output is correct
19 Correct 4 ms 7248 KB Output is correct
20 Correct 6 ms 7248 KB Output is correct
21 Correct 4 ms 7248 KB Output is correct
22 Correct 4 ms 7344 KB Output is correct
23 Correct 5 ms 7276 KB Output is correct
24 Correct 6 ms 7356 KB Output is correct
25 Correct 7 ms 7360 KB Output is correct
26 Correct 6 ms 7360 KB Output is correct
27 Correct 7 ms 7376 KB Output is correct
28 Correct 5 ms 7360 KB Output is correct
29 Correct 7 ms 7376 KB Output is correct
30 Correct 15 ms 8008 KB Output is correct
31 Correct 7 ms 7632 KB Output is correct
32 Correct 15 ms 8984 KB Output is correct
33 Correct 15 ms 8360 KB Output is correct
34 Correct 485 ms 9728 KB Output is correct
35 Correct 185 ms 8872 KB Output is correct
36 Correct 24 ms 8392 KB Output is correct
37 Correct 20 ms 8276 KB Output is correct
38 Correct 20 ms 8352 KB Output is correct
39 Correct 30 ms 8408 KB Output is correct
40 Correct 385 ms 9744 KB Output is correct
41 Correct 91 ms 8620 KB Output is correct
42 Correct 63 ms 8488 KB Output is correct
43 Correct 32 ms 9764 KB Output is correct
44 Correct 413 ms 9716 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 7248 KB Output is correct
2 Correct 4 ms 7248 KB Output is correct
3 Correct 4 ms 7348 KB Output is correct
4 Correct 4 ms 7300 KB Output is correct
5 Correct 4 ms 7248 KB Output is correct
6 Correct 4 ms 7248 KB Output is correct
7 Correct 4 ms 7352 KB Output is correct
8 Correct 4 ms 7248 KB Output is correct
9 Correct 4 ms 7248 KB Output is correct
10 Correct 4 ms 7248 KB Output is correct
11 Correct 4 ms 7248 KB Output is correct
12 Correct 3 ms 7248 KB Output is correct
13 Correct 4 ms 7248 KB Output is correct
14 Correct 4 ms 7248 KB Output is correct
15 Correct 4 ms 7248 KB Output is correct
16 Correct 5 ms 7352 KB Output is correct
17 Correct 5 ms 7248 KB Output is correct
18 Correct 4 ms 7332 KB Output is correct
19 Correct 4 ms 7248 KB Output is correct
20 Correct 6 ms 7248 KB Output is correct
21 Correct 4 ms 7248 KB Output is correct
22 Correct 4 ms 7344 KB Output is correct
23 Correct 5 ms 7276 KB Output is correct
24 Correct 6 ms 7356 KB Output is correct
25 Correct 7 ms 7360 KB Output is correct
26 Correct 6 ms 7360 KB Output is correct
27 Correct 7 ms 7376 KB Output is correct
28 Correct 5 ms 7360 KB Output is correct
29 Correct 7 ms 7376 KB Output is correct
30 Correct 15 ms 8008 KB Output is correct
31 Correct 7 ms 7632 KB Output is correct
32 Correct 15 ms 8984 KB Output is correct
33 Correct 15 ms 8360 KB Output is correct
34 Correct 485 ms 9728 KB Output is correct
35 Correct 185 ms 8872 KB Output is correct
36 Correct 24 ms 8392 KB Output is correct
37 Correct 20 ms 8276 KB Output is correct
38 Correct 20 ms 8352 KB Output is correct
39 Correct 30 ms 8408 KB Output is correct
40 Correct 385 ms 9744 KB Output is correct
41 Correct 91 ms 8620 KB Output is correct
42 Correct 63 ms 8488 KB Output is correct
43 Correct 32 ms 9764 KB Output is correct
44 Correct 413 ms 9716 KB Output is correct
45 Correct 145 ms 14120 KB Output is correct
46 Correct 9 ms 8648 KB Output is correct
47 Correct 7 ms 8656 KB Output is correct
48 Correct 207 ms 25020 KB Output is correct
49 Correct 152 ms 17888 KB Output is correct
50 Execution timed out 4103 ms 20236 KB Time limit exceeded
51 Halted 0 ms 0 KB -