#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_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]) {
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;
}
Compilation message
game.cpp: In function 'void push(int)':
game.cpp:39:4: error: 'update' was not declared in this scope; did you mean 'update_R'?
39 | update(v);
| ^~~~~~
| update_R
game.cpp:45:4: error: 'update' was not declared in this scope; did you mean 'update_R'?
45 | update(v);
| ^~~~~~
| update_R