# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
746842 |
2023-05-23T07:09:17 Z |
tutis |
Game (APIO22_game) |
C++17 |
|
4000 ms |
43784 KB |
#include <bits/stdc++.h>
using namespace std;
const int N = 300000;
int K;
vector<int>adj[N];
vector<int>adj_[N];
int mn[N];
void init(int n, int k) {
K = k;
for (int i = 0; i < n; i++)
mn[i] = k;
}
int add_teleporter(int u, int v) {
adj[u].push_back(v);
adj_[v].push_back(u);
int x = min(v, mn[v]);
int ret = 0;
function<void(int)>dfs = [&](int i) {
if (x >= mn[i])
return;
mn[i] = x;
if (i < K && x <= i) {
ret = 1;
}
for (int j : adj_[i]) {
dfs(j);
}
};
dfs(u);
return ret;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
7 ms |
14288 KB |
Output is correct |
2 |
Correct |
9 ms |
14288 KB |
Output is correct |
3 |
Correct |
8 ms |
14404 KB |
Output is correct |
4 |
Correct |
8 ms |
14288 KB |
Output is correct |
5 |
Correct |
8 ms |
14288 KB |
Output is correct |
6 |
Correct |
8 ms |
14288 KB |
Output is correct |
7 |
Correct |
8 ms |
14324 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
7 ms |
14288 KB |
Output is correct |
2 |
Correct |
9 ms |
14288 KB |
Output is correct |
3 |
Correct |
8 ms |
14404 KB |
Output is correct |
4 |
Correct |
8 ms |
14288 KB |
Output is correct |
5 |
Correct |
8 ms |
14288 KB |
Output is correct |
6 |
Correct |
8 ms |
14288 KB |
Output is correct |
7 |
Correct |
8 ms |
14324 KB |
Output is correct |
8 |
Correct |
8 ms |
14288 KB |
Output is correct |
9 |
Correct |
8 ms |
14288 KB |
Output is correct |
10 |
Correct |
9 ms |
14288 KB |
Output is correct |
11 |
Correct |
8 ms |
14288 KB |
Output is correct |
12 |
Correct |
8 ms |
14384 KB |
Output is correct |
13 |
Correct |
8 ms |
14288 KB |
Output is correct |
14 |
Correct |
8 ms |
14292 KB |
Output is correct |
15 |
Correct |
8 ms |
14288 KB |
Output is correct |
16 |
Correct |
8 ms |
14288 KB |
Output is correct |
17 |
Correct |
10 ms |
14392 KB |
Output is correct |
18 |
Correct |
8 ms |
14288 KB |
Output is correct |
19 |
Correct |
8 ms |
14288 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
7 ms |
14288 KB |
Output is correct |
2 |
Correct |
9 ms |
14288 KB |
Output is correct |
3 |
Correct |
8 ms |
14404 KB |
Output is correct |
4 |
Correct |
8 ms |
14288 KB |
Output is correct |
5 |
Correct |
8 ms |
14288 KB |
Output is correct |
6 |
Correct |
8 ms |
14288 KB |
Output is correct |
7 |
Correct |
8 ms |
14324 KB |
Output is correct |
8 |
Correct |
8 ms |
14288 KB |
Output is correct |
9 |
Correct |
8 ms |
14288 KB |
Output is correct |
10 |
Correct |
9 ms |
14288 KB |
Output is correct |
11 |
Correct |
8 ms |
14288 KB |
Output is correct |
12 |
Correct |
8 ms |
14384 KB |
Output is correct |
13 |
Correct |
8 ms |
14288 KB |
Output is correct |
14 |
Correct |
8 ms |
14292 KB |
Output is correct |
15 |
Correct |
8 ms |
14288 KB |
Output is correct |
16 |
Correct |
8 ms |
14288 KB |
Output is correct |
17 |
Correct |
10 ms |
14392 KB |
Output is correct |
18 |
Correct |
8 ms |
14288 KB |
Output is correct |
19 |
Correct |
8 ms |
14288 KB |
Output is correct |
20 |
Correct |
9 ms |
14440 KB |
Output is correct |
21 |
Correct |
8 ms |
14288 KB |
Output is correct |
22 |
Correct |
8 ms |
14416 KB |
Output is correct |
23 |
Correct |
9 ms |
14400 KB |
Output is correct |
24 |
Correct |
13 ms |
14416 KB |
Output is correct |
25 |
Correct |
11 ms |
14416 KB |
Output is correct |
26 |
Correct |
10 ms |
14416 KB |
Output is correct |
27 |
Correct |
10 ms |
14416 KB |
Output is correct |
28 |
Correct |
9 ms |
14416 KB |
Output is correct |
29 |
Correct |
12 ms |
14428 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
7 ms |
14288 KB |
Output is correct |
2 |
Correct |
9 ms |
14288 KB |
Output is correct |
3 |
Correct |
8 ms |
14404 KB |
Output is correct |
4 |
Correct |
8 ms |
14288 KB |
Output is correct |
5 |
Correct |
8 ms |
14288 KB |
Output is correct |
6 |
Correct |
8 ms |
14288 KB |
Output is correct |
7 |
Correct |
8 ms |
14324 KB |
Output is correct |
8 |
Correct |
8 ms |
14288 KB |
Output is correct |
9 |
Correct |
8 ms |
14288 KB |
Output is correct |
10 |
Correct |
9 ms |
14288 KB |
Output is correct |
11 |
Correct |
8 ms |
14288 KB |
Output is correct |
12 |
Correct |
8 ms |
14384 KB |
Output is correct |
13 |
Correct |
8 ms |
14288 KB |
Output is correct |
14 |
Correct |
8 ms |
14292 KB |
Output is correct |
15 |
Correct |
8 ms |
14288 KB |
Output is correct |
16 |
Correct |
8 ms |
14288 KB |
Output is correct |
17 |
Correct |
10 ms |
14392 KB |
Output is correct |
18 |
Correct |
8 ms |
14288 KB |
Output is correct |
19 |
Correct |
8 ms |
14288 KB |
Output is correct |
20 |
Correct |
9 ms |
14440 KB |
Output is correct |
21 |
Correct |
8 ms |
14288 KB |
Output is correct |
22 |
Correct |
8 ms |
14416 KB |
Output is correct |
23 |
Correct |
9 ms |
14400 KB |
Output is correct |
24 |
Correct |
13 ms |
14416 KB |
Output is correct |
25 |
Correct |
11 ms |
14416 KB |
Output is correct |
26 |
Correct |
10 ms |
14416 KB |
Output is correct |
27 |
Correct |
10 ms |
14416 KB |
Output is correct |
28 |
Correct |
9 ms |
14416 KB |
Output is correct |
29 |
Correct |
12 ms |
14428 KB |
Output is correct |
30 |
Correct |
23 ms |
15536 KB |
Output is correct |
31 |
Correct |
12 ms |
14800 KB |
Output is correct |
32 |
Correct |
26 ms |
17224 KB |
Output is correct |
33 |
Correct |
27 ms |
16292 KB |
Output is correct |
34 |
Correct |
550 ms |
18120 KB |
Output is correct |
35 |
Correct |
237 ms |
17148 KB |
Output is correct |
36 |
Correct |
37 ms |
16296 KB |
Output is correct |
37 |
Correct |
32 ms |
16332 KB |
Output is correct |
38 |
Correct |
32 ms |
16072 KB |
Output is correct |
39 |
Correct |
36 ms |
16048 KB |
Output is correct |
40 |
Correct |
454 ms |
18172 KB |
Output is correct |
41 |
Correct |
115 ms |
16560 KB |
Output is correct |
42 |
Correct |
80 ms |
16408 KB |
Output is correct |
43 |
Correct |
43 ms |
18224 KB |
Output is correct |
44 |
Correct |
528 ms |
18164 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
7 ms |
14288 KB |
Output is correct |
2 |
Correct |
9 ms |
14288 KB |
Output is correct |
3 |
Correct |
8 ms |
14404 KB |
Output is correct |
4 |
Correct |
8 ms |
14288 KB |
Output is correct |
5 |
Correct |
8 ms |
14288 KB |
Output is correct |
6 |
Correct |
8 ms |
14288 KB |
Output is correct |
7 |
Correct |
8 ms |
14324 KB |
Output is correct |
8 |
Correct |
8 ms |
14288 KB |
Output is correct |
9 |
Correct |
8 ms |
14288 KB |
Output is correct |
10 |
Correct |
9 ms |
14288 KB |
Output is correct |
11 |
Correct |
8 ms |
14288 KB |
Output is correct |
12 |
Correct |
8 ms |
14384 KB |
Output is correct |
13 |
Correct |
8 ms |
14288 KB |
Output is correct |
14 |
Correct |
8 ms |
14292 KB |
Output is correct |
15 |
Correct |
8 ms |
14288 KB |
Output is correct |
16 |
Correct |
8 ms |
14288 KB |
Output is correct |
17 |
Correct |
10 ms |
14392 KB |
Output is correct |
18 |
Correct |
8 ms |
14288 KB |
Output is correct |
19 |
Correct |
8 ms |
14288 KB |
Output is correct |
20 |
Correct |
9 ms |
14440 KB |
Output is correct |
21 |
Correct |
8 ms |
14288 KB |
Output is correct |
22 |
Correct |
8 ms |
14416 KB |
Output is correct |
23 |
Correct |
9 ms |
14400 KB |
Output is correct |
24 |
Correct |
13 ms |
14416 KB |
Output is correct |
25 |
Correct |
11 ms |
14416 KB |
Output is correct |
26 |
Correct |
10 ms |
14416 KB |
Output is correct |
27 |
Correct |
10 ms |
14416 KB |
Output is correct |
28 |
Correct |
9 ms |
14416 KB |
Output is correct |
29 |
Correct |
12 ms |
14428 KB |
Output is correct |
30 |
Correct |
23 ms |
15536 KB |
Output is correct |
31 |
Correct |
12 ms |
14800 KB |
Output is correct |
32 |
Correct |
26 ms |
17224 KB |
Output is correct |
33 |
Correct |
27 ms |
16292 KB |
Output is correct |
34 |
Correct |
550 ms |
18120 KB |
Output is correct |
35 |
Correct |
237 ms |
17148 KB |
Output is correct |
36 |
Correct |
37 ms |
16296 KB |
Output is correct |
37 |
Correct |
32 ms |
16332 KB |
Output is correct |
38 |
Correct |
32 ms |
16072 KB |
Output is correct |
39 |
Correct |
36 ms |
16048 KB |
Output is correct |
40 |
Correct |
454 ms |
18172 KB |
Output is correct |
41 |
Correct |
115 ms |
16560 KB |
Output is correct |
42 |
Correct |
80 ms |
16408 KB |
Output is correct |
43 |
Correct |
43 ms |
18224 KB |
Output is correct |
44 |
Correct |
528 ms |
18164 KB |
Output is correct |
45 |
Correct |
271 ms |
26880 KB |
Output is correct |
46 |
Correct |
14 ms |
15952 KB |
Output is correct |
47 |
Correct |
13 ms |
15824 KB |
Output is correct |
48 |
Correct |
334 ms |
43784 KB |
Output is correct |
49 |
Correct |
292 ms |
34356 KB |
Output is correct |
50 |
Execution timed out |
4075 ms |
34340 KB |
Time limit exceeded |
51 |
Halted |
0 ms |
0 KB |
- |