#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];
pair<int, int> range[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;
}
for (int i = 0; i < n; i++) {
range[i] = {0, k + 1};
}
}
void update(int u);
void push(int u) {
for (auto v: adj1[u]) {
if (L[u] > L[v]) {
L[v] = L[u];
update(v);
}
}
for (auto v: adj2[u]) {
if (R[u] < R[v]) {
R[v] = R[u];
update(v);
}
}
}
void update(int u) {
push(u);
}
int add_teleporter(int u, int v) {
int val = max(L[u], (u < k ? u + 1 : 0));
if (val > L[v]) {
L[v] = val;
update(v);
}
if (R[v] < R[u]) {
R[u] = R[v];
update(u);
}
adj1[u].push_back(v);
adj2[v].push_back(u);
return done;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
9 ms |
14288 KB |
Wrong Answer[1] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
9 ms |
14288 KB |
Wrong Answer[1] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
9 ms |
14288 KB |
Wrong Answer[1] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
9 ms |
14288 KB |
Wrong Answer[1] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
9 ms |
14288 KB |
Wrong Answer[1] |
2 |
Halted |
0 ms |
0 KB |
- |