#include "game.h"
#include <bits/stdc++.h>
using namespace std;
const int shift = 9;
const int maxN = 3e5 + 20;
int L[maxN];
int R[maxN];
vector<int> adj1[maxN];
vector<int> adj2[maxN];
bool done = false;
int n, k;
void init(int _n, int _k) {
n = _n;
k = _k;
for (int i = 0; i < k; i++) {
L[i] = i;
R[i] = i + 1;
}
for (int i = k; i < n; i++) {
L[i] = 0;
R[i] = k + 1;
}
}
void update_L(int u, int val);
void update_R(int u, int val);
void push(int u) {
for (auto v: adj1[u]) {
if (L[u] > L[v]) {
update_L(v, L[u]);
}
}
for (auto v: adj2[u]) {
if (R[u] < R[v]) {
update_R(v, R[u]);
}
}
}
void update_L(int u, int val) {
if (done) {
return;
}
L[u] = val;
push(u);
}
void update_R(int u, int val) {
if (done) {
return;
}
R[u] = val;
push(u);
}
int add_teleporter(int u, int v) {
int val = max(L[u], (u < k ? u + 1 : 0));
if (val > L[v]) {
update_L(v, val);
}
if (R[v] < R[u]) {
update_R(u, R[v]);
}
adj1[u].push_back(v);
adj2[v].push_back(u);
return done;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
8 ms |
14288 KB |
Wrong Answer[1] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
8 ms |
14288 KB |
Wrong Answer[1] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
8 ms |
14288 KB |
Wrong Answer[1] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
8 ms |
14288 KB |
Wrong Answer[1] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
8 ms |
14288 KB |
Wrong Answer[1] |
2 |
Halted |
0 ms |
0 KB |
- |