# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
601995 |
2022-07-22T13:15:06 Z |
patrikpavic2 |
Game (APIO22_game) |
C++17 |
|
12 ms |
23760 KB |
#include "game.h"
#include <vector>
#include <cstdio>
#define PB push_back
using namespace std;
const int N = 5e5 + 500;
int n, k, ans;
vector < int > v[N], r[N];
int L[N], R[N];
void init(int _n, int _k) {
n = _n, k = _k;
for(int i = 0;i < n;i++)
L[i] = -1, R[i] = n;
for(int i = 0;i < k;i++)
L[i] = i, R[i] = i;
}
void noviL(int x, int vr){
L[x] = vr;
for(int y : v[x])
if(L[y] < vr) noviL(y, vr);
}
void noviR(int x, int vr){
R[x] = vr;
for(int y : r[x])
if(R[y] > vr) noviR(y, vr);
}
int add_teleporter(int a, int b) {
if(L[b] < L[a]) noviL(b, L[a]);
if(R[a] > R[b]) noviR(a, R[b]);
ans |= L[a] >= R[a];
ans |= L[b] >= R[b];
return ans;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
12 ms |
23760 KB |
Output is correct |
2 |
Incorrect |
11 ms |
23760 KB |
Wrong Answer[1] |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
12 ms |
23760 KB |
Output is correct |
2 |
Incorrect |
11 ms |
23760 KB |
Wrong Answer[1] |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
12 ms |
23760 KB |
Output is correct |
2 |
Incorrect |
11 ms |
23760 KB |
Wrong Answer[1] |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
12 ms |
23760 KB |
Output is correct |
2 |
Incorrect |
11 ms |
23760 KB |
Wrong Answer[1] |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
12 ms |
23760 KB |
Output is correct |
2 |
Incorrect |
11 ms |
23760 KB |
Wrong Answer[1] |
3 |
Halted |
0 ms |
0 KB |
- |