# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
620063 |
2022-08-02T21:00:23 Z |
Lobo |
Game (APIO22_game) |
C++17 |
|
1041 ms |
6252 KB |
#include "game.h"
#include<iostream>
#include<vector>
using namespace std;
#define pb push_back
const int maxn = 5e4+10;
int n, k, smx[maxn], smn[maxn];
vector<int> g[maxn], gt[maxn];
int ans = 0;
void dfsmx(int u, int val) {
if(val <= smx[u]) return;
smx[u] = val;
if(u < k && smx[u] > u)
ans = 1;
if(u >= k && smx[u] >= smn[u])
ans = 1;
// if(smx[u] >= smn[u])
// ans = 1;
for(auto v : g[u]) {
dfsmx(v,val);
}
}
void dfsmn(int u, int val) {
if(val >= smn[u]) return;
smn[u] = val;
if(u < k && smx[u] > u)
ans = 1;
if(u >= k && smx[u] >= smn[u])
ans = 1;
// if(smx[u] >= smn[u])
// ans = 1;
for(auto v : gt[u]) {
dfsmn(v,val);
}
}
void init(int N, int K) {
n = N;
k = K;
for(int i = 0; i < k; i++) {
smn[i] = i;
smx[i] = i;
}
for(int i = k; i < n; i++) {
smn[i] = n;
smx[i] = -1;
}
}
int add_teleporter(int u, int v) {
g[u].pb(v);
gt[v].pb(u);
if(u == v && u < k) return 1;
dfsmx(v,smx[u]);
dfsmn(u,smn[v]);
return ans;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
2640 KB |
Output is correct |
2 |
Correct |
1 ms |
2640 KB |
Output is correct |
3 |
Correct |
2 ms |
2640 KB |
Output is correct |
4 |
Correct |
1 ms |
2640 KB |
Output is correct |
5 |
Correct |
2 ms |
2640 KB |
Output is correct |
6 |
Correct |
2 ms |
2640 KB |
Output is correct |
7 |
Correct |
2 ms |
2668 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
2640 KB |
Output is correct |
2 |
Correct |
1 ms |
2640 KB |
Output is correct |
3 |
Correct |
2 ms |
2640 KB |
Output is correct |
4 |
Correct |
1 ms |
2640 KB |
Output is correct |
5 |
Correct |
2 ms |
2640 KB |
Output is correct |
6 |
Correct |
2 ms |
2640 KB |
Output is correct |
7 |
Correct |
2 ms |
2668 KB |
Output is correct |
8 |
Correct |
2 ms |
2640 KB |
Output is correct |
9 |
Correct |
2 ms |
2640 KB |
Output is correct |
10 |
Correct |
1 ms |
2640 KB |
Output is correct |
11 |
Correct |
2 ms |
2640 KB |
Output is correct |
12 |
Correct |
2 ms |
2640 KB |
Output is correct |
13 |
Correct |
1 ms |
2640 KB |
Output is correct |
14 |
Correct |
1 ms |
2640 KB |
Output is correct |
15 |
Correct |
1 ms |
2640 KB |
Output is correct |
16 |
Correct |
2 ms |
2660 KB |
Output is correct |
17 |
Correct |
2 ms |
2640 KB |
Output is correct |
18 |
Correct |
2 ms |
2640 KB |
Output is correct |
19 |
Correct |
2 ms |
2640 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
2640 KB |
Output is correct |
2 |
Correct |
1 ms |
2640 KB |
Output is correct |
3 |
Correct |
2 ms |
2640 KB |
Output is correct |
4 |
Correct |
1 ms |
2640 KB |
Output is correct |
5 |
Correct |
2 ms |
2640 KB |
Output is correct |
6 |
Correct |
2 ms |
2640 KB |
Output is correct |
7 |
Correct |
2 ms |
2668 KB |
Output is correct |
8 |
Correct |
2 ms |
2640 KB |
Output is correct |
9 |
Correct |
2 ms |
2640 KB |
Output is correct |
10 |
Correct |
1 ms |
2640 KB |
Output is correct |
11 |
Correct |
2 ms |
2640 KB |
Output is correct |
12 |
Correct |
2 ms |
2640 KB |
Output is correct |
13 |
Correct |
1 ms |
2640 KB |
Output is correct |
14 |
Correct |
1 ms |
2640 KB |
Output is correct |
15 |
Correct |
1 ms |
2640 KB |
Output is correct |
16 |
Correct |
2 ms |
2660 KB |
Output is correct |
17 |
Correct |
2 ms |
2640 KB |
Output is correct |
18 |
Correct |
2 ms |
2640 KB |
Output is correct |
19 |
Correct |
2 ms |
2640 KB |
Output is correct |
20 |
Correct |
2 ms |
2640 KB |
Output is correct |
21 |
Correct |
1 ms |
2640 KB |
Output is correct |
22 |
Correct |
2 ms |
2640 KB |
Output is correct |
23 |
Correct |
2 ms |
2640 KB |
Output is correct |
24 |
Correct |
6 ms |
2668 KB |
Output is correct |
25 |
Correct |
4 ms |
2768 KB |
Output is correct |
26 |
Correct |
4 ms |
2640 KB |
Output is correct |
27 |
Correct |
4 ms |
2640 KB |
Output is correct |
28 |
Correct |
3 ms |
2704 KB |
Output is correct |
29 |
Correct |
4 ms |
2640 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
2640 KB |
Output is correct |
2 |
Correct |
1 ms |
2640 KB |
Output is correct |
3 |
Correct |
2 ms |
2640 KB |
Output is correct |
4 |
Correct |
1 ms |
2640 KB |
Output is correct |
5 |
Correct |
2 ms |
2640 KB |
Output is correct |
6 |
Correct |
2 ms |
2640 KB |
Output is correct |
7 |
Correct |
2 ms |
2668 KB |
Output is correct |
8 |
Correct |
2 ms |
2640 KB |
Output is correct |
9 |
Correct |
2 ms |
2640 KB |
Output is correct |
10 |
Correct |
1 ms |
2640 KB |
Output is correct |
11 |
Correct |
2 ms |
2640 KB |
Output is correct |
12 |
Correct |
2 ms |
2640 KB |
Output is correct |
13 |
Correct |
1 ms |
2640 KB |
Output is correct |
14 |
Correct |
1 ms |
2640 KB |
Output is correct |
15 |
Correct |
1 ms |
2640 KB |
Output is correct |
16 |
Correct |
2 ms |
2660 KB |
Output is correct |
17 |
Correct |
2 ms |
2640 KB |
Output is correct |
18 |
Correct |
2 ms |
2640 KB |
Output is correct |
19 |
Correct |
2 ms |
2640 KB |
Output is correct |
20 |
Correct |
2 ms |
2640 KB |
Output is correct |
21 |
Correct |
1 ms |
2640 KB |
Output is correct |
22 |
Correct |
2 ms |
2640 KB |
Output is correct |
23 |
Correct |
2 ms |
2640 KB |
Output is correct |
24 |
Correct |
6 ms |
2668 KB |
Output is correct |
25 |
Correct |
4 ms |
2768 KB |
Output is correct |
26 |
Correct |
4 ms |
2640 KB |
Output is correct |
27 |
Correct |
4 ms |
2640 KB |
Output is correct |
28 |
Correct |
3 ms |
2704 KB |
Output is correct |
29 |
Correct |
4 ms |
2640 KB |
Output is correct |
30 |
Correct |
21 ms |
3936 KB |
Output is correct |
31 |
Correct |
5 ms |
3284 KB |
Output is correct |
32 |
Correct |
25 ms |
5356 KB |
Output is correct |
33 |
Correct |
20 ms |
4772 KB |
Output is correct |
34 |
Correct |
1041 ms |
6076 KB |
Output is correct |
35 |
Correct |
339 ms |
5356 KB |
Output is correct |
36 |
Correct |
46 ms |
4708 KB |
Output is correct |
37 |
Correct |
38 ms |
4696 KB |
Output is correct |
38 |
Correct |
24 ms |
4440 KB |
Output is correct |
39 |
Correct |
26 ms |
4428 KB |
Output is correct |
40 |
Correct |
814 ms |
6140 KB |
Output is correct |
41 |
Correct |
152 ms |
4856 KB |
Output is correct |
42 |
Correct |
99 ms |
4708 KB |
Output is correct |
43 |
Correct |
43 ms |
6252 KB |
Output is correct |
44 |
Correct |
740 ms |
6048 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
2640 KB |
Output is correct |
2 |
Correct |
1 ms |
2640 KB |
Output is correct |
3 |
Correct |
2 ms |
2640 KB |
Output is correct |
4 |
Correct |
1 ms |
2640 KB |
Output is correct |
5 |
Correct |
2 ms |
2640 KB |
Output is correct |
6 |
Correct |
2 ms |
2640 KB |
Output is correct |
7 |
Correct |
2 ms |
2668 KB |
Output is correct |
8 |
Correct |
2 ms |
2640 KB |
Output is correct |
9 |
Correct |
2 ms |
2640 KB |
Output is correct |
10 |
Correct |
1 ms |
2640 KB |
Output is correct |
11 |
Correct |
2 ms |
2640 KB |
Output is correct |
12 |
Correct |
2 ms |
2640 KB |
Output is correct |
13 |
Correct |
1 ms |
2640 KB |
Output is correct |
14 |
Correct |
1 ms |
2640 KB |
Output is correct |
15 |
Correct |
1 ms |
2640 KB |
Output is correct |
16 |
Correct |
2 ms |
2660 KB |
Output is correct |
17 |
Correct |
2 ms |
2640 KB |
Output is correct |
18 |
Correct |
2 ms |
2640 KB |
Output is correct |
19 |
Correct |
2 ms |
2640 KB |
Output is correct |
20 |
Correct |
2 ms |
2640 KB |
Output is correct |
21 |
Correct |
1 ms |
2640 KB |
Output is correct |
22 |
Correct |
2 ms |
2640 KB |
Output is correct |
23 |
Correct |
2 ms |
2640 KB |
Output is correct |
24 |
Correct |
6 ms |
2668 KB |
Output is correct |
25 |
Correct |
4 ms |
2768 KB |
Output is correct |
26 |
Correct |
4 ms |
2640 KB |
Output is correct |
27 |
Correct |
4 ms |
2640 KB |
Output is correct |
28 |
Correct |
3 ms |
2704 KB |
Output is correct |
29 |
Correct |
4 ms |
2640 KB |
Output is correct |
30 |
Correct |
21 ms |
3936 KB |
Output is correct |
31 |
Correct |
5 ms |
3284 KB |
Output is correct |
32 |
Correct |
25 ms |
5356 KB |
Output is correct |
33 |
Correct |
20 ms |
4772 KB |
Output is correct |
34 |
Correct |
1041 ms |
6076 KB |
Output is correct |
35 |
Correct |
339 ms |
5356 KB |
Output is correct |
36 |
Correct |
46 ms |
4708 KB |
Output is correct |
37 |
Correct |
38 ms |
4696 KB |
Output is correct |
38 |
Correct |
24 ms |
4440 KB |
Output is correct |
39 |
Correct |
26 ms |
4428 KB |
Output is correct |
40 |
Correct |
814 ms |
6140 KB |
Output is correct |
41 |
Correct |
152 ms |
4856 KB |
Output is correct |
42 |
Correct |
99 ms |
4708 KB |
Output is correct |
43 |
Correct |
43 ms |
6252 KB |
Output is correct |
44 |
Correct |
740 ms |
6048 KB |
Output is correct |
45 |
Runtime error |
4 ms |
5824 KB |
Execution killed with signal 11 |
46 |
Halted |
0 ms |
0 KB |
- |