# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
726952 |
2023-04-19T16:37:59 Z |
vjudge1 |
Game (APIO22_game) |
C++17 |
|
4000 ms |
53144 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);
continue;
}
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 |
13 ms |
23692 KB |
Output is correct |
3 |
Correct |
12 ms |
23780 KB |
Output is correct |
4 |
Correct |
15 ms |
23772 KB |
Output is correct |
5 |
Correct |
15 ms |
23692 KB |
Output is correct |
6 |
Correct |
15 ms |
23716 KB |
Output is correct |
7 |
Correct |
13 ms |
23744 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
11 ms |
23760 KB |
Output is correct |
2 |
Correct |
13 ms |
23692 KB |
Output is correct |
3 |
Correct |
12 ms |
23780 KB |
Output is correct |
4 |
Correct |
15 ms |
23772 KB |
Output is correct |
5 |
Correct |
15 ms |
23692 KB |
Output is correct |
6 |
Correct |
15 ms |
23716 KB |
Output is correct |
7 |
Correct |
13 ms |
23744 KB |
Output is correct |
8 |
Correct |
12 ms |
23760 KB |
Output is correct |
9 |
Correct |
14 ms |
23760 KB |
Output is correct |
10 |
Correct |
11 ms |
23760 KB |
Output is correct |
11 |
Correct |
13 ms |
23684 KB |
Output is correct |
12 |
Correct |
12 ms |
23784 KB |
Output is correct |
13 |
Correct |
13 ms |
23716 KB |
Output is correct |
14 |
Correct |
12 ms |
23780 KB |
Output is correct |
15 |
Correct |
12 ms |
23760 KB |
Output is correct |
16 |
Correct |
13 ms |
23780 KB |
Output is correct |
17 |
Correct |
13 ms |
23760 KB |
Output is correct |
18 |
Correct |
15 ms |
23792 KB |
Output is correct |
19 |
Correct |
12 ms |
23760 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
11 ms |
23760 KB |
Output is correct |
2 |
Correct |
13 ms |
23692 KB |
Output is correct |
3 |
Correct |
12 ms |
23780 KB |
Output is correct |
4 |
Correct |
15 ms |
23772 KB |
Output is correct |
5 |
Correct |
15 ms |
23692 KB |
Output is correct |
6 |
Correct |
15 ms |
23716 KB |
Output is correct |
7 |
Correct |
13 ms |
23744 KB |
Output is correct |
8 |
Correct |
12 ms |
23760 KB |
Output is correct |
9 |
Correct |
14 ms |
23760 KB |
Output is correct |
10 |
Correct |
11 ms |
23760 KB |
Output is correct |
11 |
Correct |
13 ms |
23684 KB |
Output is correct |
12 |
Correct |
12 ms |
23784 KB |
Output is correct |
13 |
Correct |
13 ms |
23716 KB |
Output is correct |
14 |
Correct |
12 ms |
23780 KB |
Output is correct |
15 |
Correct |
12 ms |
23760 KB |
Output is correct |
16 |
Correct |
13 ms |
23780 KB |
Output is correct |
17 |
Correct |
13 ms |
23760 KB |
Output is correct |
18 |
Correct |
15 ms |
23792 KB |
Output is correct |
19 |
Correct |
12 ms |
23760 KB |
Output is correct |
20 |
Correct |
12 ms |
23760 KB |
Output is correct |
21 |
Correct |
13 ms |
23680 KB |
Output is correct |
22 |
Correct |
13 ms |
23800 KB |
Output is correct |
23 |
Correct |
13 ms |
23888 KB |
Output is correct |
24 |
Correct |
20 ms |
23860 KB |
Output is correct |
25 |
Correct |
20 ms |
23928 KB |
Output is correct |
26 |
Correct |
17 ms |
23896 KB |
Output is correct |
27 |
Correct |
18 ms |
23788 KB |
Output is correct |
28 |
Correct |
14 ms |
23820 KB |
Output is correct |
29 |
Correct |
19 ms |
23924 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
11 ms |
23760 KB |
Output is correct |
2 |
Correct |
13 ms |
23692 KB |
Output is correct |
3 |
Correct |
12 ms |
23780 KB |
Output is correct |
4 |
Correct |
15 ms |
23772 KB |
Output is correct |
5 |
Correct |
15 ms |
23692 KB |
Output is correct |
6 |
Correct |
15 ms |
23716 KB |
Output is correct |
7 |
Correct |
13 ms |
23744 KB |
Output is correct |
8 |
Correct |
12 ms |
23760 KB |
Output is correct |
9 |
Correct |
14 ms |
23760 KB |
Output is correct |
10 |
Correct |
11 ms |
23760 KB |
Output is correct |
11 |
Correct |
13 ms |
23684 KB |
Output is correct |
12 |
Correct |
12 ms |
23784 KB |
Output is correct |
13 |
Correct |
13 ms |
23716 KB |
Output is correct |
14 |
Correct |
12 ms |
23780 KB |
Output is correct |
15 |
Correct |
12 ms |
23760 KB |
Output is correct |
16 |
Correct |
13 ms |
23780 KB |
Output is correct |
17 |
Correct |
13 ms |
23760 KB |
Output is correct |
18 |
Correct |
15 ms |
23792 KB |
Output is correct |
19 |
Correct |
12 ms |
23760 KB |
Output is correct |
20 |
Correct |
12 ms |
23760 KB |
Output is correct |
21 |
Correct |
13 ms |
23680 KB |
Output is correct |
22 |
Correct |
13 ms |
23800 KB |
Output is correct |
23 |
Correct |
13 ms |
23888 KB |
Output is correct |
24 |
Correct |
20 ms |
23860 KB |
Output is correct |
25 |
Correct |
20 ms |
23928 KB |
Output is correct |
26 |
Correct |
17 ms |
23896 KB |
Output is correct |
27 |
Correct |
18 ms |
23788 KB |
Output is correct |
28 |
Correct |
14 ms |
23820 KB |
Output is correct |
29 |
Correct |
19 ms |
23924 KB |
Output is correct |
30 |
Correct |
44 ms |
25548 KB |
Output is correct |
31 |
Correct |
21 ms |
24404 KB |
Output is correct |
32 |
Correct |
55 ms |
26704 KB |
Output is correct |
33 |
Correct |
42 ms |
26740 KB |
Output is correct |
34 |
Correct |
1067 ms |
26700 KB |
Output is correct |
35 |
Correct |
356 ms |
26988 KB |
Output is correct |
36 |
Correct |
73 ms |
26684 KB |
Output is correct |
37 |
Correct |
74 ms |
26568 KB |
Output is correct |
38 |
Correct |
91 ms |
26452 KB |
Output is correct |
39 |
Correct |
96 ms |
26556 KB |
Output is correct |
40 |
Correct |
856 ms |
27072 KB |
Output is correct |
41 |
Correct |
173 ms |
26464 KB |
Output is correct |
42 |
Correct |
140 ms |
26400 KB |
Output is correct |
43 |
Correct |
108 ms |
26916 KB |
Output is correct |
44 |
Correct |
1385 ms |
26884 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
11 ms |
23760 KB |
Output is correct |
2 |
Correct |
13 ms |
23692 KB |
Output is correct |
3 |
Correct |
12 ms |
23780 KB |
Output is correct |
4 |
Correct |
15 ms |
23772 KB |
Output is correct |
5 |
Correct |
15 ms |
23692 KB |
Output is correct |
6 |
Correct |
15 ms |
23716 KB |
Output is correct |
7 |
Correct |
13 ms |
23744 KB |
Output is correct |
8 |
Correct |
12 ms |
23760 KB |
Output is correct |
9 |
Correct |
14 ms |
23760 KB |
Output is correct |
10 |
Correct |
11 ms |
23760 KB |
Output is correct |
11 |
Correct |
13 ms |
23684 KB |
Output is correct |
12 |
Correct |
12 ms |
23784 KB |
Output is correct |
13 |
Correct |
13 ms |
23716 KB |
Output is correct |
14 |
Correct |
12 ms |
23780 KB |
Output is correct |
15 |
Correct |
12 ms |
23760 KB |
Output is correct |
16 |
Correct |
13 ms |
23780 KB |
Output is correct |
17 |
Correct |
13 ms |
23760 KB |
Output is correct |
18 |
Correct |
15 ms |
23792 KB |
Output is correct |
19 |
Correct |
12 ms |
23760 KB |
Output is correct |
20 |
Correct |
12 ms |
23760 KB |
Output is correct |
21 |
Correct |
13 ms |
23680 KB |
Output is correct |
22 |
Correct |
13 ms |
23800 KB |
Output is correct |
23 |
Correct |
13 ms |
23888 KB |
Output is correct |
24 |
Correct |
20 ms |
23860 KB |
Output is correct |
25 |
Correct |
20 ms |
23928 KB |
Output is correct |
26 |
Correct |
17 ms |
23896 KB |
Output is correct |
27 |
Correct |
18 ms |
23788 KB |
Output is correct |
28 |
Correct |
14 ms |
23820 KB |
Output is correct |
29 |
Correct |
19 ms |
23924 KB |
Output is correct |
30 |
Correct |
44 ms |
25548 KB |
Output is correct |
31 |
Correct |
21 ms |
24404 KB |
Output is correct |
32 |
Correct |
55 ms |
26704 KB |
Output is correct |
33 |
Correct |
42 ms |
26740 KB |
Output is correct |
34 |
Correct |
1067 ms |
26700 KB |
Output is correct |
35 |
Correct |
356 ms |
26988 KB |
Output is correct |
36 |
Correct |
73 ms |
26684 KB |
Output is correct |
37 |
Correct |
74 ms |
26568 KB |
Output is correct |
38 |
Correct |
91 ms |
26452 KB |
Output is correct |
39 |
Correct |
96 ms |
26556 KB |
Output is correct |
40 |
Correct |
856 ms |
27072 KB |
Output is correct |
41 |
Correct |
173 ms |
26464 KB |
Output is correct |
42 |
Correct |
140 ms |
26400 KB |
Output is correct |
43 |
Correct |
108 ms |
26916 KB |
Output is correct |
44 |
Correct |
1385 ms |
26884 KB |
Output is correct |
45 |
Correct |
387 ms |
42240 KB |
Output is correct |
46 |
Correct |
24 ms |
25520 KB |
Output is correct |
47 |
Correct |
25 ms |
25472 KB |
Output is correct |
48 |
Correct |
438 ms |
53144 KB |
Output is correct |
49 |
Correct |
451 ms |
53116 KB |
Output is correct |
50 |
Execution timed out |
4062 ms |
31028 KB |
Time limit exceeded |
51 |
Halted |
0 ms |
0 KB |
- |