Submission #726951

# Submission time Handle Problem Language Result Execution time Memory
726951 2023-04-19T16:37:00 Z vjudge1 Game (APIO22_game) C++17
30 / 100
1689 ms 262144 KB
#include <bits/stdc++.h>
using namespace std;
#include "game.h"

int N, K;
int f[300000];
vector<int> adj[300000], radj[300000];

void init(int n, int k) {
        N = n, K = k;
        for (int i = 0; i < N; i++) f[i] = N;
}

priority_queue<pair<int, int>> pq[300000];

int add_teleporter(int u, int v) {
        adj[u].emplace_back(v);
        radj[v].emplace_back(u);
        pq[v].emplace(f[u], u);
        int F = v < K ? v : f[v];
        queue<int> q;
        q.emplace(v);
        while (q.size()) {
                int v = q.front();
                q.pop();
                while (pq[v].size()) {
                        auto [fu, u] = pq[v].top();
                        if (fu <= F) break;
                        pq[v].pop();
                        if (f[u] != fu) {
                                if (f[u] > F) q.emplace(u);
                                f[u] = min(f[u], F);
                                pq[v].emplace(f[u], u);
                        }
                        f[u] = F;
                        pq[v].emplace(f[u], u);
                        q.emplace(u);
                }
        }
        for (int i = 0; i < K; i++) {
                if (f[i] <= i) return 1;
        }
        return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 11 ms 23760 KB Output is correct
2 Correct 11 ms 23676 KB Output is correct
3 Correct 12 ms 23736 KB Output is correct
4 Correct 14 ms 23760 KB Output is correct
5 Correct 12 ms 23760 KB Output is correct
6 Correct 11 ms 23760 KB Output is correct
7 Correct 13 ms 23768 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 11 ms 23760 KB Output is correct
2 Correct 11 ms 23676 KB Output is correct
3 Correct 12 ms 23736 KB Output is correct
4 Correct 14 ms 23760 KB Output is correct
5 Correct 12 ms 23760 KB Output is correct
6 Correct 11 ms 23760 KB Output is correct
7 Correct 13 ms 23768 KB Output is correct
8 Correct 12 ms 23760 KB Output is correct
9 Correct 11 ms 23760 KB Output is correct
10 Correct 12 ms 23760 KB Output is correct
11 Correct 13 ms 23792 KB Output is correct
12 Correct 12 ms 23760 KB Output is correct
13 Correct 13 ms 23748 KB Output is correct
14 Correct 12 ms 23792 KB Output is correct
15 Correct 12 ms 23772 KB Output is correct
16 Correct 11 ms 23760 KB Output is correct
17 Correct 12 ms 23760 KB Output is correct
18 Correct 13 ms 23708 KB Output is correct
19 Correct 15 ms 23748 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 11 ms 23760 KB Output is correct
2 Correct 11 ms 23676 KB Output is correct
3 Correct 12 ms 23736 KB Output is correct
4 Correct 14 ms 23760 KB Output is correct
5 Correct 12 ms 23760 KB Output is correct
6 Correct 11 ms 23760 KB Output is correct
7 Correct 13 ms 23768 KB Output is correct
8 Correct 12 ms 23760 KB Output is correct
9 Correct 11 ms 23760 KB Output is correct
10 Correct 12 ms 23760 KB Output is correct
11 Correct 13 ms 23792 KB Output is correct
12 Correct 12 ms 23760 KB Output is correct
13 Correct 13 ms 23748 KB Output is correct
14 Correct 12 ms 23792 KB Output is correct
15 Correct 12 ms 23772 KB Output is correct
16 Correct 11 ms 23760 KB Output is correct
17 Correct 12 ms 23760 KB Output is correct
18 Correct 13 ms 23708 KB Output is correct
19 Correct 15 ms 23748 KB Output is correct
20 Correct 13 ms 23760 KB Output is correct
21 Correct 12 ms 23760 KB Output is correct
22 Correct 12 ms 23760 KB Output is correct
23 Correct 13 ms 23760 KB Output is correct
24 Correct 19 ms 23816 KB Output is correct
25 Correct 16 ms 23932 KB Output is correct
26 Correct 16 ms 23888 KB Output is correct
27 Correct 16 ms 23888 KB Output is correct
28 Correct 13 ms 23752 KB Output is correct
29 Correct 15 ms 23888 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 11 ms 23760 KB Output is correct
2 Correct 11 ms 23676 KB Output is correct
3 Correct 12 ms 23736 KB Output is correct
4 Correct 14 ms 23760 KB Output is correct
5 Correct 12 ms 23760 KB Output is correct
6 Correct 11 ms 23760 KB Output is correct
7 Correct 13 ms 23768 KB Output is correct
8 Correct 12 ms 23760 KB Output is correct
9 Correct 11 ms 23760 KB Output is correct
10 Correct 12 ms 23760 KB Output is correct
11 Correct 13 ms 23792 KB Output is correct
12 Correct 12 ms 23760 KB Output is correct
13 Correct 13 ms 23748 KB Output is correct
14 Correct 12 ms 23792 KB Output is correct
15 Correct 12 ms 23772 KB Output is correct
16 Correct 11 ms 23760 KB Output is correct
17 Correct 12 ms 23760 KB Output is correct
18 Correct 13 ms 23708 KB Output is correct
19 Correct 15 ms 23748 KB Output is correct
20 Correct 13 ms 23760 KB Output is correct
21 Correct 12 ms 23760 KB Output is correct
22 Correct 12 ms 23760 KB Output is correct
23 Correct 13 ms 23760 KB Output is correct
24 Correct 19 ms 23816 KB Output is correct
25 Correct 16 ms 23932 KB Output is correct
26 Correct 16 ms 23888 KB Output is correct
27 Correct 16 ms 23888 KB Output is correct
28 Correct 13 ms 23752 KB Output is correct
29 Correct 15 ms 23888 KB Output is correct
30 Correct 42 ms 25548 KB Output is correct
31 Correct 21 ms 24496 KB Output is correct
32 Correct 35 ms 26596 KB Output is correct
33 Correct 37 ms 26656 KB Output is correct
34 Correct 881 ms 26680 KB Output is correct
35 Correct 324 ms 27080 KB Output is correct
36 Correct 56 ms 27084 KB Output is correct
37 Correct 83 ms 26896 KB Output is correct
38 Correct 74 ms 26600 KB Output is correct
39 Correct 73 ms 26724 KB Output is correct
40 Correct 648 ms 27080 KB Output is correct
41 Correct 168 ms 26724 KB Output is correct
42 Correct 136 ms 26548 KB Output is correct
43 Correct 85 ms 27336 KB Output is correct
44 Runtime error 1689 ms 262144 KB Execution killed with signal 9
45 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 11 ms 23760 KB Output is correct
2 Correct 11 ms 23676 KB Output is correct
3 Correct 12 ms 23736 KB Output is correct
4 Correct 14 ms 23760 KB Output is correct
5 Correct 12 ms 23760 KB Output is correct
6 Correct 11 ms 23760 KB Output is correct
7 Correct 13 ms 23768 KB Output is correct
8 Correct 12 ms 23760 KB Output is correct
9 Correct 11 ms 23760 KB Output is correct
10 Correct 12 ms 23760 KB Output is correct
11 Correct 13 ms 23792 KB Output is correct
12 Correct 12 ms 23760 KB Output is correct
13 Correct 13 ms 23748 KB Output is correct
14 Correct 12 ms 23792 KB Output is correct
15 Correct 12 ms 23772 KB Output is correct
16 Correct 11 ms 23760 KB Output is correct
17 Correct 12 ms 23760 KB Output is correct
18 Correct 13 ms 23708 KB Output is correct
19 Correct 15 ms 23748 KB Output is correct
20 Correct 13 ms 23760 KB Output is correct
21 Correct 12 ms 23760 KB Output is correct
22 Correct 12 ms 23760 KB Output is correct
23 Correct 13 ms 23760 KB Output is correct
24 Correct 19 ms 23816 KB Output is correct
25 Correct 16 ms 23932 KB Output is correct
26 Correct 16 ms 23888 KB Output is correct
27 Correct 16 ms 23888 KB Output is correct
28 Correct 13 ms 23752 KB Output is correct
29 Correct 15 ms 23888 KB Output is correct
30 Correct 42 ms 25548 KB Output is correct
31 Correct 21 ms 24496 KB Output is correct
32 Correct 35 ms 26596 KB Output is correct
33 Correct 37 ms 26656 KB Output is correct
34 Correct 881 ms 26680 KB Output is correct
35 Correct 324 ms 27080 KB Output is correct
36 Correct 56 ms 27084 KB Output is correct
37 Correct 83 ms 26896 KB Output is correct
38 Correct 74 ms 26600 KB Output is correct
39 Correct 73 ms 26724 KB Output is correct
40 Correct 648 ms 27080 KB Output is correct
41 Correct 168 ms 26724 KB Output is correct
42 Correct 136 ms 26548 KB Output is correct
43 Correct 85 ms 27336 KB Output is correct
44 Runtime error 1689 ms 262144 KB Execution killed with signal 9
45 Halted 0 ms 0 KB -