# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
620061 |
2022-08-02T20:52:18 Z |
Lobo |
Game (APIO22_game) |
C++17 |
|
1 ms |
2640 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;
for(auto v : g[u]) {
dfsmx(v,val);
}
}
void dfsmn(int u, int val) {
if(val >= smx[u]) return;
smn[u] = val;
if(u < k && smx[u] > u)
ans = 1;
if(u >= k && 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);
dfsmx(v,smx[u]);
dfsmn(u,smn[v]);
return ans;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
2640 KB |
Wrong Answer[1] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
2640 KB |
Wrong Answer[1] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
2640 KB |
Wrong Answer[1] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
2640 KB |
Wrong Answer[1] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
2640 KB |
Wrong Answer[1] |
2 |
Halted |
0 ms |
0 KB |
- |