Submission #1064950

# Submission time Handle Problem Language Result Execution time Memory
1064950 2024-08-18T19:59:08 Z sammyuri Game (APIO22_game) C++17
60 / 100
512 ms 3408 KB
#include "game.h"
#include <bits/stdc++.h>
using namespace std;

const int MAXN = 30005;
vector<int> adj[MAXN];
int smallest[MAXN];
int nn, kk;

void init(int n, int k) {
    nn = n; kk = k;
    for (int i = 0; i < n; i ++)
        smallest[i] = k;
}

void dfs(int node) {
    for (auto a : adj[node]) {
        if (smallest[a] > smallest[node]) {
            smallest[a] = smallest[node];
            dfs(a);
        }
    }
}

int add_teleporter(int u, int v) {
    adj[v].push_back(u);
    int cur = smallest[v];
    if (v < kk)
        cur = v;
    if (smallest[u] > cur) {
        smallest[u] = cur;
        dfs(u);
    }
    for (int i = 0; i < kk; i ++)
        if (smallest[i] <= i)
            return 1;
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 1112 KB Output is correct
2 Correct 0 ms 1112 KB Output is correct
3 Correct 1 ms 1112 KB Output is correct
4 Correct 0 ms 1112 KB Output is correct
5 Correct 1 ms 1112 KB Output is correct
6 Correct 0 ms 1112 KB Output is correct
7 Correct 1 ms 1112 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 1112 KB Output is correct
2 Correct 0 ms 1112 KB Output is correct
3 Correct 1 ms 1112 KB Output is correct
4 Correct 0 ms 1112 KB Output is correct
5 Correct 1 ms 1112 KB Output is correct
6 Correct 0 ms 1112 KB Output is correct
7 Correct 1 ms 1112 KB Output is correct
8 Correct 0 ms 1112 KB Output is correct
9 Correct 0 ms 1112 KB Output is correct
10 Correct 1 ms 1112 KB Output is correct
11 Correct 1 ms 1112 KB Output is correct
12 Correct 1 ms 1136 KB Output is correct
13 Correct 1 ms 1112 KB Output is correct
14 Correct 0 ms 1112 KB Output is correct
15 Correct 1 ms 1112 KB Output is correct
16 Correct 1 ms 1112 KB Output is correct
17 Correct 1 ms 1112 KB Output is correct
18 Correct 1 ms 1112 KB Output is correct
19 Correct 1 ms 1112 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 1112 KB Output is correct
2 Correct 0 ms 1112 KB Output is correct
3 Correct 1 ms 1112 KB Output is correct
4 Correct 0 ms 1112 KB Output is correct
5 Correct 1 ms 1112 KB Output is correct
6 Correct 0 ms 1112 KB Output is correct
7 Correct 1 ms 1112 KB Output is correct
8 Correct 0 ms 1112 KB Output is correct
9 Correct 0 ms 1112 KB Output is correct
10 Correct 1 ms 1112 KB Output is correct
11 Correct 1 ms 1112 KB Output is correct
12 Correct 1 ms 1136 KB Output is correct
13 Correct 1 ms 1112 KB Output is correct
14 Correct 0 ms 1112 KB Output is correct
15 Correct 1 ms 1112 KB Output is correct
16 Correct 1 ms 1112 KB Output is correct
17 Correct 1 ms 1112 KB Output is correct
18 Correct 1 ms 1112 KB Output is correct
19 Correct 1 ms 1112 KB Output is correct
20 Correct 1 ms 1112 KB Output is correct
21 Correct 1 ms 1112 KB Output is correct
22 Correct 1 ms 1112 KB Output is correct
23 Correct 1 ms 1112 KB Output is correct
24 Correct 2 ms 1112 KB Output is correct
25 Correct 2 ms 1112 KB Output is correct
26 Correct 2 ms 1112 KB Output is correct
27 Correct 2 ms 1112 KB Output is correct
28 Correct 2 ms 1112 KB Output is correct
29 Correct 2 ms 1112 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 1112 KB Output is correct
2 Correct 0 ms 1112 KB Output is correct
3 Correct 1 ms 1112 KB Output is correct
4 Correct 0 ms 1112 KB Output is correct
5 Correct 1 ms 1112 KB Output is correct
6 Correct 0 ms 1112 KB Output is correct
7 Correct 1 ms 1112 KB Output is correct
8 Correct 0 ms 1112 KB Output is correct
9 Correct 0 ms 1112 KB Output is correct
10 Correct 1 ms 1112 KB Output is correct
11 Correct 1 ms 1112 KB Output is correct
12 Correct 1 ms 1136 KB Output is correct
13 Correct 1 ms 1112 KB Output is correct
14 Correct 0 ms 1112 KB Output is correct
15 Correct 1 ms 1112 KB Output is correct
16 Correct 1 ms 1112 KB Output is correct
17 Correct 1 ms 1112 KB Output is correct
18 Correct 1 ms 1112 KB Output is correct
19 Correct 1 ms 1112 KB Output is correct
20 Correct 1 ms 1112 KB Output is correct
21 Correct 1 ms 1112 KB Output is correct
22 Correct 1 ms 1112 KB Output is correct
23 Correct 1 ms 1112 KB Output is correct
24 Correct 2 ms 1112 KB Output is correct
25 Correct 2 ms 1112 KB Output is correct
26 Correct 2 ms 1112 KB Output is correct
27 Correct 2 ms 1112 KB Output is correct
28 Correct 2 ms 1112 KB Output is correct
29 Correct 2 ms 1112 KB Output is correct
30 Correct 9 ms 1624 KB Output is correct
31 Correct 5 ms 1368 KB Output is correct
32 Correct 14 ms 2524 KB Output is correct
33 Correct 11 ms 2136 KB Output is correct
34 Correct 512 ms 2904 KB Output is correct
35 Correct 199 ms 2380 KB Output is correct
36 Correct 16 ms 2136 KB Output is correct
37 Correct 26 ms 2152 KB Output is correct
38 Correct 41 ms 2016 KB Output is correct
39 Correct 28 ms 1968 KB Output is correct
40 Correct 430 ms 3408 KB Output is correct
41 Correct 95 ms 2208 KB Output is correct
42 Correct 83 ms 2356 KB Output is correct
43 Correct 36 ms 2896 KB Output is correct
44 Correct 450 ms 2896 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 1112 KB Output is correct
2 Correct 0 ms 1112 KB Output is correct
3 Correct 1 ms 1112 KB Output is correct
4 Correct 0 ms 1112 KB Output is correct
5 Correct 1 ms 1112 KB Output is correct
6 Correct 0 ms 1112 KB Output is correct
7 Correct 1 ms 1112 KB Output is correct
8 Correct 0 ms 1112 KB Output is correct
9 Correct 0 ms 1112 KB Output is correct
10 Correct 1 ms 1112 KB Output is correct
11 Correct 1 ms 1112 KB Output is correct
12 Correct 1 ms 1136 KB Output is correct
13 Correct 1 ms 1112 KB Output is correct
14 Correct 0 ms 1112 KB Output is correct
15 Correct 1 ms 1112 KB Output is correct
16 Correct 1 ms 1112 KB Output is correct
17 Correct 1 ms 1112 KB Output is correct
18 Correct 1 ms 1112 KB Output is correct
19 Correct 1 ms 1112 KB Output is correct
20 Correct 1 ms 1112 KB Output is correct
21 Correct 1 ms 1112 KB Output is correct
22 Correct 1 ms 1112 KB Output is correct
23 Correct 1 ms 1112 KB Output is correct
24 Correct 2 ms 1112 KB Output is correct
25 Correct 2 ms 1112 KB Output is correct
26 Correct 2 ms 1112 KB Output is correct
27 Correct 2 ms 1112 KB Output is correct
28 Correct 2 ms 1112 KB Output is correct
29 Correct 2 ms 1112 KB Output is correct
30 Correct 9 ms 1624 KB Output is correct
31 Correct 5 ms 1368 KB Output is correct
32 Correct 14 ms 2524 KB Output is correct
33 Correct 11 ms 2136 KB Output is correct
34 Correct 512 ms 2904 KB Output is correct
35 Correct 199 ms 2380 KB Output is correct
36 Correct 16 ms 2136 KB Output is correct
37 Correct 26 ms 2152 KB Output is correct
38 Correct 41 ms 2016 KB Output is correct
39 Correct 28 ms 1968 KB Output is correct
40 Correct 430 ms 3408 KB Output is correct
41 Correct 95 ms 2208 KB Output is correct
42 Correct 83 ms 2356 KB Output is correct
43 Correct 36 ms 2896 KB Output is correct
44 Correct 450 ms 2896 KB Output is correct
45 Runtime error 1 ms 2136 KB Execution killed with signal 11
46 Halted 0 ms 0 KB -