# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1003163 |
2024-06-20T07:01:20 Z |
mispertion |
Game (APIO22_game) |
C++17 |
|
4000 ms |
54608 KB |
#include "game.h"
#include <bits/stdc++.h>
using namespace std;
#define pb(x) push_back(x);
const int N = 5e5;
const int infi = INT_MAX;
vector<int> g[N], ig[N];
int mxs[N], mns[N], n, k;
bool dfsmn(int v){
bool was = false;
for(auto u : ig[v]){
if(mns[u] > mns[v]){
mns[u] = mns[v];
if((mns[u] <= mxs[u] && u >= k) || ((mns[u] < mxs[u] && u < k)))
was = true;
if(dfsmn(u))
was = true;
}
}
return was;
}
bool dfsmx(int v){
bool was = false;
if((mns[v] <= mxs[v] && v >= k) || ((mns[v] < mxs[v] && v < k)))
was = true;
for(auto u : g[v]){
if(mxs[u] < mxs[v]){
mxs[u] = mxs[v];
if(dfsmx(u))
was = true;
}
}
return was;
}
void init(int _n, int _k) {
n = _n;
k = _k;
for(int i = 0; i < k; i++)
mns[i] = mxs[i] = i;
for(int i = k; i < n; i++)
mns[i] = infi, mxs[i] = -infi;
}
int add_teleporter(int u, int v) {
if(u == v && u < k)
return 1;
if(u == v)
return 0;
g[u].pb(v);
ig[v].pb(u);
int ret = 0;
if(mns[v] < mns[u]){
mns[u] = mns[v];
if(dfsmn(u))
ret = 1;
}
if(mxs[v] < mxs[u]){
mxs[v] = mxs[u];
if(dfsmx(v))
ret = 1;
}
return ret;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
10 ms |
23896 KB |
Output is correct |
2 |
Correct |
10 ms |
23896 KB |
Output is correct |
3 |
Correct |
10 ms |
23896 KB |
Output is correct |
4 |
Correct |
11 ms |
23896 KB |
Output is correct |
5 |
Correct |
10 ms |
23896 KB |
Output is correct |
6 |
Correct |
10 ms |
23896 KB |
Output is correct |
7 |
Correct |
10 ms |
23920 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
10 ms |
23896 KB |
Output is correct |
2 |
Correct |
10 ms |
23896 KB |
Output is correct |
3 |
Correct |
10 ms |
23896 KB |
Output is correct |
4 |
Correct |
11 ms |
23896 KB |
Output is correct |
5 |
Correct |
10 ms |
23896 KB |
Output is correct |
6 |
Correct |
10 ms |
23896 KB |
Output is correct |
7 |
Correct |
10 ms |
23920 KB |
Output is correct |
8 |
Correct |
13 ms |
23896 KB |
Output is correct |
9 |
Correct |
10 ms |
23896 KB |
Output is correct |
10 |
Correct |
10 ms |
23896 KB |
Output is correct |
11 |
Correct |
10 ms |
23896 KB |
Output is correct |
12 |
Correct |
11 ms |
23896 KB |
Output is correct |
13 |
Correct |
10 ms |
23896 KB |
Output is correct |
14 |
Correct |
10 ms |
23896 KB |
Output is correct |
15 |
Correct |
10 ms |
23904 KB |
Output is correct |
16 |
Correct |
11 ms |
23896 KB |
Output is correct |
17 |
Correct |
10 ms |
23896 KB |
Output is correct |
18 |
Correct |
10 ms |
23904 KB |
Output is correct |
19 |
Correct |
10 ms |
23896 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
10 ms |
23896 KB |
Output is correct |
2 |
Correct |
10 ms |
23896 KB |
Output is correct |
3 |
Correct |
10 ms |
23896 KB |
Output is correct |
4 |
Correct |
11 ms |
23896 KB |
Output is correct |
5 |
Correct |
10 ms |
23896 KB |
Output is correct |
6 |
Correct |
10 ms |
23896 KB |
Output is correct |
7 |
Correct |
10 ms |
23920 KB |
Output is correct |
8 |
Correct |
13 ms |
23896 KB |
Output is correct |
9 |
Correct |
10 ms |
23896 KB |
Output is correct |
10 |
Correct |
10 ms |
23896 KB |
Output is correct |
11 |
Correct |
10 ms |
23896 KB |
Output is correct |
12 |
Correct |
11 ms |
23896 KB |
Output is correct |
13 |
Correct |
10 ms |
23896 KB |
Output is correct |
14 |
Correct |
10 ms |
23896 KB |
Output is correct |
15 |
Correct |
10 ms |
23904 KB |
Output is correct |
16 |
Correct |
11 ms |
23896 KB |
Output is correct |
17 |
Correct |
10 ms |
23896 KB |
Output is correct |
18 |
Correct |
10 ms |
23904 KB |
Output is correct |
19 |
Correct |
10 ms |
23896 KB |
Output is correct |
20 |
Correct |
10 ms |
23896 KB |
Output is correct |
21 |
Correct |
10 ms |
23704 KB |
Output is correct |
22 |
Correct |
10 ms |
23896 KB |
Output is correct |
23 |
Correct |
10 ms |
23896 KB |
Output is correct |
24 |
Correct |
13 ms |
23912 KB |
Output is correct |
25 |
Correct |
11 ms |
23896 KB |
Output is correct |
26 |
Correct |
14 ms |
24152 KB |
Output is correct |
27 |
Correct |
13 ms |
23848 KB |
Output is correct |
28 |
Correct |
11 ms |
23896 KB |
Output is correct |
29 |
Correct |
11 ms |
23896 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
10 ms |
23896 KB |
Output is correct |
2 |
Correct |
10 ms |
23896 KB |
Output is correct |
3 |
Correct |
10 ms |
23896 KB |
Output is correct |
4 |
Correct |
11 ms |
23896 KB |
Output is correct |
5 |
Correct |
10 ms |
23896 KB |
Output is correct |
6 |
Correct |
10 ms |
23896 KB |
Output is correct |
7 |
Correct |
10 ms |
23920 KB |
Output is correct |
8 |
Correct |
13 ms |
23896 KB |
Output is correct |
9 |
Correct |
10 ms |
23896 KB |
Output is correct |
10 |
Correct |
10 ms |
23896 KB |
Output is correct |
11 |
Correct |
10 ms |
23896 KB |
Output is correct |
12 |
Correct |
11 ms |
23896 KB |
Output is correct |
13 |
Correct |
10 ms |
23896 KB |
Output is correct |
14 |
Correct |
10 ms |
23896 KB |
Output is correct |
15 |
Correct |
10 ms |
23904 KB |
Output is correct |
16 |
Correct |
11 ms |
23896 KB |
Output is correct |
17 |
Correct |
10 ms |
23896 KB |
Output is correct |
18 |
Correct |
10 ms |
23904 KB |
Output is correct |
19 |
Correct |
10 ms |
23896 KB |
Output is correct |
20 |
Correct |
10 ms |
23896 KB |
Output is correct |
21 |
Correct |
10 ms |
23704 KB |
Output is correct |
22 |
Correct |
10 ms |
23896 KB |
Output is correct |
23 |
Correct |
10 ms |
23896 KB |
Output is correct |
24 |
Correct |
13 ms |
23912 KB |
Output is correct |
25 |
Correct |
11 ms |
23896 KB |
Output is correct |
26 |
Correct |
14 ms |
24152 KB |
Output is correct |
27 |
Correct |
13 ms |
23848 KB |
Output is correct |
28 |
Correct |
11 ms |
23896 KB |
Output is correct |
29 |
Correct |
11 ms |
23896 KB |
Output is correct |
30 |
Correct |
21 ms |
25176 KB |
Output is correct |
31 |
Correct |
13 ms |
24408 KB |
Output is correct |
32 |
Correct |
22 ms |
26712 KB |
Output is correct |
33 |
Correct |
21 ms |
25900 KB |
Output is correct |
34 |
Correct |
1037 ms |
27788 KB |
Output is correct |
35 |
Correct |
360 ms |
26448 KB |
Output is correct |
36 |
Correct |
33 ms |
26008 KB |
Output is correct |
37 |
Correct |
30 ms |
26192 KB |
Output is correct |
38 |
Correct |
26 ms |
25688 KB |
Output is correct |
39 |
Correct |
31 ms |
26220 KB |
Output is correct |
40 |
Correct |
850 ms |
27732 KB |
Output is correct |
41 |
Correct |
181 ms |
26192 KB |
Output is correct |
42 |
Correct |
117 ms |
25932 KB |
Output is correct |
43 |
Correct |
39 ms |
27984 KB |
Output is correct |
44 |
Correct |
712 ms |
27984 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
10 ms |
23896 KB |
Output is correct |
2 |
Correct |
10 ms |
23896 KB |
Output is correct |
3 |
Correct |
10 ms |
23896 KB |
Output is correct |
4 |
Correct |
11 ms |
23896 KB |
Output is correct |
5 |
Correct |
10 ms |
23896 KB |
Output is correct |
6 |
Correct |
10 ms |
23896 KB |
Output is correct |
7 |
Correct |
10 ms |
23920 KB |
Output is correct |
8 |
Correct |
13 ms |
23896 KB |
Output is correct |
9 |
Correct |
10 ms |
23896 KB |
Output is correct |
10 |
Correct |
10 ms |
23896 KB |
Output is correct |
11 |
Correct |
10 ms |
23896 KB |
Output is correct |
12 |
Correct |
11 ms |
23896 KB |
Output is correct |
13 |
Correct |
10 ms |
23896 KB |
Output is correct |
14 |
Correct |
10 ms |
23896 KB |
Output is correct |
15 |
Correct |
10 ms |
23904 KB |
Output is correct |
16 |
Correct |
11 ms |
23896 KB |
Output is correct |
17 |
Correct |
10 ms |
23896 KB |
Output is correct |
18 |
Correct |
10 ms |
23904 KB |
Output is correct |
19 |
Correct |
10 ms |
23896 KB |
Output is correct |
20 |
Correct |
10 ms |
23896 KB |
Output is correct |
21 |
Correct |
10 ms |
23704 KB |
Output is correct |
22 |
Correct |
10 ms |
23896 KB |
Output is correct |
23 |
Correct |
10 ms |
23896 KB |
Output is correct |
24 |
Correct |
13 ms |
23912 KB |
Output is correct |
25 |
Correct |
11 ms |
23896 KB |
Output is correct |
26 |
Correct |
14 ms |
24152 KB |
Output is correct |
27 |
Correct |
13 ms |
23848 KB |
Output is correct |
28 |
Correct |
11 ms |
23896 KB |
Output is correct |
29 |
Correct |
11 ms |
23896 KB |
Output is correct |
30 |
Correct |
21 ms |
25176 KB |
Output is correct |
31 |
Correct |
13 ms |
24408 KB |
Output is correct |
32 |
Correct |
22 ms |
26712 KB |
Output is correct |
33 |
Correct |
21 ms |
25900 KB |
Output is correct |
34 |
Correct |
1037 ms |
27788 KB |
Output is correct |
35 |
Correct |
360 ms |
26448 KB |
Output is correct |
36 |
Correct |
33 ms |
26008 KB |
Output is correct |
37 |
Correct |
30 ms |
26192 KB |
Output is correct |
38 |
Correct |
26 ms |
25688 KB |
Output is correct |
39 |
Correct |
31 ms |
26220 KB |
Output is correct |
40 |
Correct |
850 ms |
27732 KB |
Output is correct |
41 |
Correct |
181 ms |
26192 KB |
Output is correct |
42 |
Correct |
117 ms |
25932 KB |
Output is correct |
43 |
Correct |
39 ms |
27984 KB |
Output is correct |
44 |
Correct |
712 ms |
27984 KB |
Output is correct |
45 |
Correct |
156 ms |
37456 KB |
Output is correct |
46 |
Correct |
16 ms |
26692 KB |
Output is correct |
47 |
Correct |
14 ms |
26456 KB |
Output is correct |
48 |
Correct |
233 ms |
54608 KB |
Output is correct |
49 |
Correct |
146 ms |
44880 KB |
Output is correct |
50 |
Execution timed out |
4096 ms |
45184 KB |
Time limit exceeded |
51 |
Halted |
0 ms |
0 KB |
- |