# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
978520 |
2024-05-09T09:33:29 Z |
Tsagana |
Game (APIO22_game) |
C++17 |
|
4000 ms |
21772 KB |
#include "game.h"
//OP
#include<bits/stdc++.h>
#define IOS ios_base::sync_with_stdio(false);cin.tie();cout.tie();
#define all(x) x.begin(), x.end()
#define pi pair<int, int >
#define pq priority_queue
#define lb lower_bound
#define ub upper_bound
#define pb push_back
#define eb emplace_back
#define mset multiset
#define F first
#define S second
using namespace std;
struct graph
{
int n, k;
vector<int> edge[300005];
int cn[300005];
void dfs(int s, int ms) {
if (cn[s] <= ms) return ;
cn[s] = ms;
for (auto i: edge[s]) dfs(i, ms);
}
void add_edge(int u, int v) {
edge[v].pb(u);
if (v < k) dfs(u, v);
else dfs(u, cn[v]);
}
int check_stamp() {
for (int i = 0; i < k; i++)
if (cn[i] <= i) return 1;
return 0;
}
};
graph G;
void init(int n, int k) {
G.n = n; G.k = k;
for (int i = k-1; i < n; i++) G.cn[i] = 1e6;
for (int i = 0; i < k-1; i++) {
G.cn[i] = i+1;
G.add_edge(i, i+1);
}
}
int add_teleporter(int u, int v) {
G.add_edge(u, v);
return G.check_stamp();
}
//ED
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
7256 KB |
Output is correct |
2 |
Correct |
2 ms |
7256 KB |
Output is correct |
3 |
Correct |
2 ms |
7256 KB |
Output is correct |
4 |
Correct |
2 ms |
7256 KB |
Output is correct |
5 |
Correct |
2 ms |
7256 KB |
Output is correct |
6 |
Correct |
2 ms |
7256 KB |
Output is correct |
7 |
Correct |
2 ms |
7256 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
7256 KB |
Output is correct |
2 |
Correct |
2 ms |
7256 KB |
Output is correct |
3 |
Correct |
2 ms |
7256 KB |
Output is correct |
4 |
Correct |
2 ms |
7256 KB |
Output is correct |
5 |
Correct |
2 ms |
7256 KB |
Output is correct |
6 |
Correct |
2 ms |
7256 KB |
Output is correct |
7 |
Correct |
2 ms |
7256 KB |
Output is correct |
8 |
Correct |
2 ms |
7256 KB |
Output is correct |
9 |
Correct |
2 ms |
7256 KB |
Output is correct |
10 |
Correct |
2 ms |
7256 KB |
Output is correct |
11 |
Correct |
2 ms |
7256 KB |
Output is correct |
12 |
Correct |
2 ms |
7256 KB |
Output is correct |
13 |
Correct |
2 ms |
7256 KB |
Output is correct |
14 |
Correct |
2 ms |
7256 KB |
Output is correct |
15 |
Correct |
2 ms |
7256 KB |
Output is correct |
16 |
Correct |
2 ms |
7256 KB |
Output is correct |
17 |
Correct |
2 ms |
7256 KB |
Output is correct |
18 |
Correct |
2 ms |
7256 KB |
Output is correct |
19 |
Correct |
2 ms |
7256 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
7256 KB |
Output is correct |
2 |
Correct |
2 ms |
7256 KB |
Output is correct |
3 |
Correct |
2 ms |
7256 KB |
Output is correct |
4 |
Correct |
2 ms |
7256 KB |
Output is correct |
5 |
Correct |
2 ms |
7256 KB |
Output is correct |
6 |
Correct |
2 ms |
7256 KB |
Output is correct |
7 |
Correct |
2 ms |
7256 KB |
Output is correct |
8 |
Correct |
2 ms |
7256 KB |
Output is correct |
9 |
Correct |
2 ms |
7256 KB |
Output is correct |
10 |
Correct |
2 ms |
7256 KB |
Output is correct |
11 |
Correct |
2 ms |
7256 KB |
Output is correct |
12 |
Correct |
2 ms |
7256 KB |
Output is correct |
13 |
Correct |
2 ms |
7256 KB |
Output is correct |
14 |
Correct |
2 ms |
7256 KB |
Output is correct |
15 |
Correct |
2 ms |
7256 KB |
Output is correct |
16 |
Correct |
2 ms |
7256 KB |
Output is correct |
17 |
Correct |
2 ms |
7256 KB |
Output is correct |
18 |
Correct |
2 ms |
7256 KB |
Output is correct |
19 |
Correct |
2 ms |
7256 KB |
Output is correct |
20 |
Correct |
2 ms |
7256 KB |
Output is correct |
21 |
Correct |
2 ms |
7256 KB |
Output is correct |
22 |
Correct |
2 ms |
7512 KB |
Output is correct |
23 |
Correct |
2 ms |
7508 KB |
Output is correct |
24 |
Correct |
3 ms |
7512 KB |
Output is correct |
25 |
Correct |
4 ms |
7768 KB |
Output is correct |
26 |
Correct |
3 ms |
8024 KB |
Output is correct |
27 |
Correct |
4 ms |
7768 KB |
Output is correct |
28 |
Correct |
3 ms |
7768 KB |
Output is correct |
29 |
Correct |
3 ms |
7512 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
7256 KB |
Output is correct |
2 |
Correct |
2 ms |
7256 KB |
Output is correct |
3 |
Correct |
2 ms |
7256 KB |
Output is correct |
4 |
Correct |
2 ms |
7256 KB |
Output is correct |
5 |
Correct |
2 ms |
7256 KB |
Output is correct |
6 |
Correct |
2 ms |
7256 KB |
Output is correct |
7 |
Correct |
2 ms |
7256 KB |
Output is correct |
8 |
Correct |
2 ms |
7256 KB |
Output is correct |
9 |
Correct |
2 ms |
7256 KB |
Output is correct |
10 |
Correct |
2 ms |
7256 KB |
Output is correct |
11 |
Correct |
2 ms |
7256 KB |
Output is correct |
12 |
Correct |
2 ms |
7256 KB |
Output is correct |
13 |
Correct |
2 ms |
7256 KB |
Output is correct |
14 |
Correct |
2 ms |
7256 KB |
Output is correct |
15 |
Correct |
2 ms |
7256 KB |
Output is correct |
16 |
Correct |
2 ms |
7256 KB |
Output is correct |
17 |
Correct |
2 ms |
7256 KB |
Output is correct |
18 |
Correct |
2 ms |
7256 KB |
Output is correct |
19 |
Correct |
2 ms |
7256 KB |
Output is correct |
20 |
Correct |
2 ms |
7256 KB |
Output is correct |
21 |
Correct |
2 ms |
7256 KB |
Output is correct |
22 |
Correct |
2 ms |
7512 KB |
Output is correct |
23 |
Correct |
2 ms |
7508 KB |
Output is correct |
24 |
Correct |
3 ms |
7512 KB |
Output is correct |
25 |
Correct |
4 ms |
7768 KB |
Output is correct |
26 |
Correct |
3 ms |
8024 KB |
Output is correct |
27 |
Correct |
4 ms |
7768 KB |
Output is correct |
28 |
Correct |
3 ms |
7768 KB |
Output is correct |
29 |
Correct |
3 ms |
7512 KB |
Output is correct |
30 |
Correct |
13 ms |
8584 KB |
Output is correct |
31 |
Correct |
7 ms |
7768 KB |
Output is correct |
32 |
Correct |
14 ms |
9068 KB |
Output is correct |
33 |
Correct |
13 ms |
8792 KB |
Output is correct |
34 |
Correct |
392 ms |
9216 KB |
Output is correct |
35 |
Correct |
157 ms |
9240 KB |
Output is correct |
36 |
Correct |
21 ms |
8504 KB |
Output is correct |
37 |
Correct |
32 ms |
9084 KB |
Output is correct |
38 |
Correct |
35 ms |
8776 KB |
Output is correct |
39 |
Correct |
31 ms |
8824 KB |
Output is correct |
40 |
Correct |
335 ms |
9428 KB |
Output is correct |
41 |
Correct |
80 ms |
9008 KB |
Output is correct |
42 |
Correct |
64 ms |
9080 KB |
Output is correct |
43 |
Correct |
43 ms |
10116 KB |
Output is correct |
44 |
Correct |
356 ms |
9384 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
7256 KB |
Output is correct |
2 |
Correct |
2 ms |
7256 KB |
Output is correct |
3 |
Correct |
2 ms |
7256 KB |
Output is correct |
4 |
Correct |
2 ms |
7256 KB |
Output is correct |
5 |
Correct |
2 ms |
7256 KB |
Output is correct |
6 |
Correct |
2 ms |
7256 KB |
Output is correct |
7 |
Correct |
2 ms |
7256 KB |
Output is correct |
8 |
Correct |
2 ms |
7256 KB |
Output is correct |
9 |
Correct |
2 ms |
7256 KB |
Output is correct |
10 |
Correct |
2 ms |
7256 KB |
Output is correct |
11 |
Correct |
2 ms |
7256 KB |
Output is correct |
12 |
Correct |
2 ms |
7256 KB |
Output is correct |
13 |
Correct |
2 ms |
7256 KB |
Output is correct |
14 |
Correct |
2 ms |
7256 KB |
Output is correct |
15 |
Correct |
2 ms |
7256 KB |
Output is correct |
16 |
Correct |
2 ms |
7256 KB |
Output is correct |
17 |
Correct |
2 ms |
7256 KB |
Output is correct |
18 |
Correct |
2 ms |
7256 KB |
Output is correct |
19 |
Correct |
2 ms |
7256 KB |
Output is correct |
20 |
Correct |
2 ms |
7256 KB |
Output is correct |
21 |
Correct |
2 ms |
7256 KB |
Output is correct |
22 |
Correct |
2 ms |
7512 KB |
Output is correct |
23 |
Correct |
2 ms |
7508 KB |
Output is correct |
24 |
Correct |
3 ms |
7512 KB |
Output is correct |
25 |
Correct |
4 ms |
7768 KB |
Output is correct |
26 |
Correct |
3 ms |
8024 KB |
Output is correct |
27 |
Correct |
4 ms |
7768 KB |
Output is correct |
28 |
Correct |
3 ms |
7768 KB |
Output is correct |
29 |
Correct |
3 ms |
7512 KB |
Output is correct |
30 |
Correct |
13 ms |
8584 KB |
Output is correct |
31 |
Correct |
7 ms |
7768 KB |
Output is correct |
32 |
Correct |
14 ms |
9068 KB |
Output is correct |
33 |
Correct |
13 ms |
8792 KB |
Output is correct |
34 |
Correct |
392 ms |
9216 KB |
Output is correct |
35 |
Correct |
157 ms |
9240 KB |
Output is correct |
36 |
Correct |
21 ms |
8504 KB |
Output is correct |
37 |
Correct |
32 ms |
9084 KB |
Output is correct |
38 |
Correct |
35 ms |
8776 KB |
Output is correct |
39 |
Correct |
31 ms |
8824 KB |
Output is correct |
40 |
Correct |
335 ms |
9428 KB |
Output is correct |
41 |
Correct |
80 ms |
9008 KB |
Output is correct |
42 |
Correct |
64 ms |
9080 KB |
Output is correct |
43 |
Correct |
43 ms |
10116 KB |
Output is correct |
44 |
Correct |
356 ms |
9384 KB |
Output is correct |
45 |
Correct |
135 ms |
14904 KB |
Output is correct |
46 |
Correct |
11 ms |
9304 KB |
Output is correct |
47 |
Correct |
8 ms |
8792 KB |
Output is correct |
48 |
Correct |
145 ms |
21772 KB |
Output is correct |
49 |
Correct |
151 ms |
18620 KB |
Output is correct |
50 |
Execution timed out |
4072 ms |
16144 KB |
Time limit exceeded |
51 |
Halted |
0 ms |
0 KB |
- |