# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
982716 |
2024-05-14T16:33:52 Z |
vjudge1 |
Game (APIO22_game) |
C++17 |
|
4000 ms |
27752 KB |
#include "game.h"
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vll = vector <ll>;
const ll MAXN = 3E5+16;
int n, k;
vll adj[MAXN];
ll maxK[MAXN];
void init (int n, int k) {
::n = n, ::k = k;
fill(maxK, maxK+n+4, -1);
for (ll i = 0; i < k; i++) maxK[i] = i;
for (ll i = 1; i < k; i++) {
adj[i-1].push_back(i);
}
}
ll tvis[MAXN];
ll timer = 1;
ll dfs (ll u) {
if (tvis[u] == timer) return 0;
tvis[u] = timer;
for (ll v : adj[u]) {
if (v <= maxK[u]) return 1;
if (maxK[v] >= maxK[u]) continue; // this pruning is insane (hopefully)
maxK[v] = maxK[u];
if (dfs(v)) return 1;
}
return 0;
}
int add_teleporter (int u, int v) {
adj[u].push_back(v);
timer++;
return dfs(u);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
9816 KB |
Output is correct |
2 |
Correct |
2 ms |
9816 KB |
Output is correct |
3 |
Correct |
2 ms |
10068 KB |
Output is correct |
4 |
Correct |
3 ms |
9816 KB |
Output is correct |
5 |
Correct |
2 ms |
9816 KB |
Output is correct |
6 |
Correct |
2 ms |
9816 KB |
Output is correct |
7 |
Correct |
2 ms |
7768 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
9816 KB |
Output is correct |
2 |
Correct |
2 ms |
9816 KB |
Output is correct |
3 |
Correct |
2 ms |
10068 KB |
Output is correct |
4 |
Correct |
3 ms |
9816 KB |
Output is correct |
5 |
Correct |
2 ms |
9816 KB |
Output is correct |
6 |
Correct |
2 ms |
9816 KB |
Output is correct |
7 |
Correct |
2 ms |
7768 KB |
Output is correct |
8 |
Correct |
2 ms |
7768 KB |
Output is correct |
9 |
Correct |
2 ms |
7768 KB |
Output is correct |
10 |
Correct |
3 ms |
9816 KB |
Output is correct |
11 |
Correct |
2 ms |
9816 KB |
Output is correct |
12 |
Correct |
2 ms |
7768 KB |
Output is correct |
13 |
Correct |
2 ms |
9816 KB |
Output is correct |
14 |
Correct |
2 ms |
9816 KB |
Output is correct |
15 |
Correct |
2 ms |
9816 KB |
Output is correct |
16 |
Correct |
2 ms |
7768 KB |
Output is correct |
17 |
Correct |
2 ms |
7768 KB |
Output is correct |
18 |
Correct |
2 ms |
7848 KB |
Output is correct |
19 |
Correct |
3 ms |
7764 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
9816 KB |
Output is correct |
2 |
Correct |
2 ms |
9816 KB |
Output is correct |
3 |
Correct |
2 ms |
10068 KB |
Output is correct |
4 |
Correct |
3 ms |
9816 KB |
Output is correct |
5 |
Correct |
2 ms |
9816 KB |
Output is correct |
6 |
Correct |
2 ms |
9816 KB |
Output is correct |
7 |
Correct |
2 ms |
7768 KB |
Output is correct |
8 |
Correct |
2 ms |
7768 KB |
Output is correct |
9 |
Correct |
2 ms |
7768 KB |
Output is correct |
10 |
Correct |
3 ms |
9816 KB |
Output is correct |
11 |
Correct |
2 ms |
9816 KB |
Output is correct |
12 |
Correct |
2 ms |
7768 KB |
Output is correct |
13 |
Correct |
2 ms |
9816 KB |
Output is correct |
14 |
Correct |
2 ms |
9816 KB |
Output is correct |
15 |
Correct |
2 ms |
9816 KB |
Output is correct |
16 |
Correct |
2 ms |
7768 KB |
Output is correct |
17 |
Correct |
2 ms |
7768 KB |
Output is correct |
18 |
Correct |
2 ms |
7848 KB |
Output is correct |
19 |
Correct |
3 ms |
7764 KB |
Output is correct |
20 |
Correct |
3 ms |
7768 KB |
Output is correct |
21 |
Correct |
2 ms |
7768 KB |
Output is correct |
22 |
Correct |
5 ms |
7768 KB |
Output is correct |
23 |
Correct |
3 ms |
7768 KB |
Output is correct |
24 |
Correct |
5 ms |
7768 KB |
Output is correct |
25 |
Correct |
4 ms |
8024 KB |
Output is correct |
26 |
Correct |
5 ms |
8024 KB |
Output is correct |
27 |
Correct |
4 ms |
10072 KB |
Output is correct |
28 |
Correct |
4 ms |
9816 KB |
Output is correct |
29 |
Correct |
3 ms |
9816 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
9816 KB |
Output is correct |
2 |
Correct |
2 ms |
9816 KB |
Output is correct |
3 |
Correct |
2 ms |
10068 KB |
Output is correct |
4 |
Correct |
3 ms |
9816 KB |
Output is correct |
5 |
Correct |
2 ms |
9816 KB |
Output is correct |
6 |
Correct |
2 ms |
9816 KB |
Output is correct |
7 |
Correct |
2 ms |
7768 KB |
Output is correct |
8 |
Correct |
2 ms |
7768 KB |
Output is correct |
9 |
Correct |
2 ms |
7768 KB |
Output is correct |
10 |
Correct |
3 ms |
9816 KB |
Output is correct |
11 |
Correct |
2 ms |
9816 KB |
Output is correct |
12 |
Correct |
2 ms |
7768 KB |
Output is correct |
13 |
Correct |
2 ms |
9816 KB |
Output is correct |
14 |
Correct |
2 ms |
9816 KB |
Output is correct |
15 |
Correct |
2 ms |
9816 KB |
Output is correct |
16 |
Correct |
2 ms |
7768 KB |
Output is correct |
17 |
Correct |
2 ms |
7768 KB |
Output is correct |
18 |
Correct |
2 ms |
7848 KB |
Output is correct |
19 |
Correct |
3 ms |
7764 KB |
Output is correct |
20 |
Correct |
3 ms |
7768 KB |
Output is correct |
21 |
Correct |
2 ms |
7768 KB |
Output is correct |
22 |
Correct |
5 ms |
7768 KB |
Output is correct |
23 |
Correct |
3 ms |
7768 KB |
Output is correct |
24 |
Correct |
5 ms |
7768 KB |
Output is correct |
25 |
Correct |
4 ms |
8024 KB |
Output is correct |
26 |
Correct |
5 ms |
8024 KB |
Output is correct |
27 |
Correct |
4 ms |
10072 KB |
Output is correct |
28 |
Correct |
4 ms |
9816 KB |
Output is correct |
29 |
Correct |
3 ms |
9816 KB |
Output is correct |
30 |
Correct |
15 ms |
11420 KB |
Output is correct |
31 |
Correct |
6 ms |
10328 KB |
Output is correct |
32 |
Correct |
14 ms |
11944 KB |
Output is correct |
33 |
Correct |
14 ms |
11628 KB |
Output is correct |
34 |
Correct |
463 ms |
12696 KB |
Output is correct |
35 |
Correct |
175 ms |
12112 KB |
Output is correct |
36 |
Correct |
30 ms |
11688 KB |
Output is correct |
37 |
Correct |
22 ms |
11348 KB |
Output is correct |
38 |
Correct |
20 ms |
11184 KB |
Output is correct |
39 |
Correct |
21 ms |
11096 KB |
Output is correct |
40 |
Correct |
408 ms |
12704 KB |
Output is correct |
41 |
Correct |
89 ms |
10180 KB |
Output is correct |
42 |
Correct |
57 ms |
11444 KB |
Output is correct |
43 |
Correct |
24 ms |
11264 KB |
Output is correct |
44 |
Correct |
261 ms |
12820 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
9816 KB |
Output is correct |
2 |
Correct |
2 ms |
9816 KB |
Output is correct |
3 |
Correct |
2 ms |
10068 KB |
Output is correct |
4 |
Correct |
3 ms |
9816 KB |
Output is correct |
5 |
Correct |
2 ms |
9816 KB |
Output is correct |
6 |
Correct |
2 ms |
9816 KB |
Output is correct |
7 |
Correct |
2 ms |
7768 KB |
Output is correct |
8 |
Correct |
2 ms |
7768 KB |
Output is correct |
9 |
Correct |
2 ms |
7768 KB |
Output is correct |
10 |
Correct |
3 ms |
9816 KB |
Output is correct |
11 |
Correct |
2 ms |
9816 KB |
Output is correct |
12 |
Correct |
2 ms |
7768 KB |
Output is correct |
13 |
Correct |
2 ms |
9816 KB |
Output is correct |
14 |
Correct |
2 ms |
9816 KB |
Output is correct |
15 |
Correct |
2 ms |
9816 KB |
Output is correct |
16 |
Correct |
2 ms |
7768 KB |
Output is correct |
17 |
Correct |
2 ms |
7768 KB |
Output is correct |
18 |
Correct |
2 ms |
7848 KB |
Output is correct |
19 |
Correct |
3 ms |
7764 KB |
Output is correct |
20 |
Correct |
3 ms |
7768 KB |
Output is correct |
21 |
Correct |
2 ms |
7768 KB |
Output is correct |
22 |
Correct |
5 ms |
7768 KB |
Output is correct |
23 |
Correct |
3 ms |
7768 KB |
Output is correct |
24 |
Correct |
5 ms |
7768 KB |
Output is correct |
25 |
Correct |
4 ms |
8024 KB |
Output is correct |
26 |
Correct |
5 ms |
8024 KB |
Output is correct |
27 |
Correct |
4 ms |
10072 KB |
Output is correct |
28 |
Correct |
4 ms |
9816 KB |
Output is correct |
29 |
Correct |
3 ms |
9816 KB |
Output is correct |
30 |
Correct |
15 ms |
11420 KB |
Output is correct |
31 |
Correct |
6 ms |
10328 KB |
Output is correct |
32 |
Correct |
14 ms |
11944 KB |
Output is correct |
33 |
Correct |
14 ms |
11628 KB |
Output is correct |
34 |
Correct |
463 ms |
12696 KB |
Output is correct |
35 |
Correct |
175 ms |
12112 KB |
Output is correct |
36 |
Correct |
30 ms |
11688 KB |
Output is correct |
37 |
Correct |
22 ms |
11348 KB |
Output is correct |
38 |
Correct |
20 ms |
11184 KB |
Output is correct |
39 |
Correct |
21 ms |
11096 KB |
Output is correct |
40 |
Correct |
408 ms |
12704 KB |
Output is correct |
41 |
Correct |
89 ms |
10180 KB |
Output is correct |
42 |
Correct |
57 ms |
11444 KB |
Output is correct |
43 |
Correct |
24 ms |
11264 KB |
Output is correct |
44 |
Correct |
261 ms |
12820 KB |
Output is correct |
45 |
Correct |
140 ms |
18792 KB |
Output is correct |
46 |
Correct |
8 ms |
12376 KB |
Output is correct |
47 |
Correct |
7 ms |
12404 KB |
Output is correct |
48 |
Correct |
244 ms |
27752 KB |
Output is correct |
49 |
Correct |
144 ms |
21992 KB |
Output is correct |
50 |
Execution timed out |
4085 ms |
27524 KB |
Time limit exceeded |
51 |
Halted |
0 ms |
0 KB |
- |