Submission #726924

# Submission time Handle Problem Language Result Execution time Memory
726924 2023-04-19T15:05:36 Z vjudge1 Game (APIO22_game) C++17
30 / 100
4000 ms 9852 KB
#include <bits/stdc++.h>
using namespace std;
#include "game.h"

using Bitset = bitset<1000>;
int N, K;
Bitset reachable[300000];

void init(int n, int k) {
        N = n, K = k;
}

vector<int> adj[300000];
int vis[300000];
int f[300000];
int timer = 0;

int DP(int u) {
        if (vis[u] == timer) return f[u];
        vis[u] = timer;
        f[u] = 1e9;
        for (int v : adj[u]) {
                if (v < K) {
                        f[u] = min(v, f[u]);
                } else {
                        f[u] = min(f[u], DP(v));
                }
        }
        return f[u];
}

int add_teleporter(int u, int v) {
        ++timer;
        adj[u].emplace_back(v);
        for (int i = 0; i < K; i++) {
                if (DP(i) <= i) return 1;
        }
        return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 4 ms 7248 KB Output is correct
2 Correct 4 ms 7248 KB Output is correct
3 Correct 5 ms 7332 KB Output is correct
4 Correct 6 ms 7348 KB Output is correct
5 Correct 5 ms 7352 KB Output is correct
6 Correct 5 ms 7368 KB Output is correct
7 Correct 6 ms 7368 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 7248 KB Output is correct
2 Correct 4 ms 7248 KB Output is correct
3 Correct 5 ms 7332 KB Output is correct
4 Correct 6 ms 7348 KB Output is correct
5 Correct 5 ms 7352 KB Output is correct
6 Correct 5 ms 7368 KB Output is correct
7 Correct 6 ms 7368 KB Output is correct
8 Correct 6 ms 7248 KB Output is correct
9 Correct 4 ms 7248 KB Output is correct
10 Correct 5 ms 7324 KB Output is correct
11 Correct 4 ms 7368 KB Output is correct
12 Correct 4 ms 7292 KB Output is correct
13 Correct 4 ms 7248 KB Output is correct
14 Correct 5 ms 7248 KB Output is correct
15 Correct 5 ms 7296 KB Output is correct
16 Correct 5 ms 7248 KB Output is correct
17 Correct 5 ms 7368 KB Output is correct
18 Correct 5 ms 7248 KB Output is correct
19 Correct 4 ms 7288 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 7248 KB Output is correct
2 Correct 4 ms 7248 KB Output is correct
3 Correct 5 ms 7332 KB Output is correct
4 Correct 6 ms 7348 KB Output is correct
5 Correct 5 ms 7352 KB Output is correct
6 Correct 5 ms 7368 KB Output is correct
7 Correct 6 ms 7368 KB Output is correct
8 Correct 6 ms 7248 KB Output is correct
9 Correct 4 ms 7248 KB Output is correct
10 Correct 5 ms 7324 KB Output is correct
11 Correct 4 ms 7368 KB Output is correct
12 Correct 4 ms 7292 KB Output is correct
13 Correct 4 ms 7248 KB Output is correct
14 Correct 5 ms 7248 KB Output is correct
15 Correct 5 ms 7296 KB Output is correct
16 Correct 5 ms 7248 KB Output is correct
17 Correct 5 ms 7368 KB Output is correct
18 Correct 5 ms 7248 KB Output is correct
19 Correct 4 ms 7288 KB Output is correct
20 Correct 6 ms 7376 KB Output is correct
21 Correct 4 ms 7376 KB Output is correct
22 Correct 8 ms 7412 KB Output is correct
23 Correct 4 ms 7376 KB Output is correct
24 Correct 12 ms 7312 KB Output is correct
25 Correct 47 ms 7376 KB Output is correct
26 Correct 82 ms 7408 KB Output is correct
27 Correct 81 ms 7384 KB Output is correct
28 Correct 27 ms 7392 KB Output is correct
29 Correct 60 ms 7392 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 7248 KB Output is correct
2 Correct 4 ms 7248 KB Output is correct
3 Correct 5 ms 7332 KB Output is correct
4 Correct 6 ms 7348 KB Output is correct
5 Correct 5 ms 7352 KB Output is correct
6 Correct 5 ms 7368 KB Output is correct
7 Correct 6 ms 7368 KB Output is correct
8 Correct 6 ms 7248 KB Output is correct
9 Correct 4 ms 7248 KB Output is correct
10 Correct 5 ms 7324 KB Output is correct
11 Correct 4 ms 7368 KB Output is correct
12 Correct 4 ms 7292 KB Output is correct
13 Correct 4 ms 7248 KB Output is correct
14 Correct 5 ms 7248 KB Output is correct
15 Correct 5 ms 7296 KB Output is correct
16 Correct 5 ms 7248 KB Output is correct
17 Correct 5 ms 7368 KB Output is correct
18 Correct 5 ms 7248 KB Output is correct
19 Correct 4 ms 7288 KB Output is correct
20 Correct 6 ms 7376 KB Output is correct
21 Correct 4 ms 7376 KB Output is correct
22 Correct 8 ms 7412 KB Output is correct
23 Correct 4 ms 7376 KB Output is correct
24 Correct 12 ms 7312 KB Output is correct
25 Correct 47 ms 7376 KB Output is correct
26 Correct 82 ms 7408 KB Output is correct
27 Correct 81 ms 7384 KB Output is correct
28 Correct 27 ms 7392 KB Output is correct
29 Correct 60 ms 7392 KB Output is correct
30 Correct 146 ms 8148 KB Output is correct
31 Correct 56 ms 7680 KB Output is correct
32 Correct 61 ms 9180 KB Output is correct
33 Correct 28 ms 8468 KB Output is correct
34 Correct 1234 ms 9852 KB Output is correct
35 Execution timed out 4094 ms 8704 KB Time limit exceeded
36 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 4 ms 7248 KB Output is correct
2 Correct 4 ms 7248 KB Output is correct
3 Correct 5 ms 7332 KB Output is correct
4 Correct 6 ms 7348 KB Output is correct
5 Correct 5 ms 7352 KB Output is correct
6 Correct 5 ms 7368 KB Output is correct
7 Correct 6 ms 7368 KB Output is correct
8 Correct 6 ms 7248 KB Output is correct
9 Correct 4 ms 7248 KB Output is correct
10 Correct 5 ms 7324 KB Output is correct
11 Correct 4 ms 7368 KB Output is correct
12 Correct 4 ms 7292 KB Output is correct
13 Correct 4 ms 7248 KB Output is correct
14 Correct 5 ms 7248 KB Output is correct
15 Correct 5 ms 7296 KB Output is correct
16 Correct 5 ms 7248 KB Output is correct
17 Correct 5 ms 7368 KB Output is correct
18 Correct 5 ms 7248 KB Output is correct
19 Correct 4 ms 7288 KB Output is correct
20 Correct 6 ms 7376 KB Output is correct
21 Correct 4 ms 7376 KB Output is correct
22 Correct 8 ms 7412 KB Output is correct
23 Correct 4 ms 7376 KB Output is correct
24 Correct 12 ms 7312 KB Output is correct
25 Correct 47 ms 7376 KB Output is correct
26 Correct 82 ms 7408 KB Output is correct
27 Correct 81 ms 7384 KB Output is correct
28 Correct 27 ms 7392 KB Output is correct
29 Correct 60 ms 7392 KB Output is correct
30 Correct 146 ms 8148 KB Output is correct
31 Correct 56 ms 7680 KB Output is correct
32 Correct 61 ms 9180 KB Output is correct
33 Correct 28 ms 8468 KB Output is correct
34 Correct 1234 ms 9852 KB Output is correct
35 Execution timed out 4094 ms 8704 KB Time limit exceeded
36 Halted 0 ms 0 KB -