Submission #725213

#TimeUsernameProblemLanguageResultExecution timeMemory
725213SanguineChameleonGame (APIO22_game)C++17
Compilation error
0 ms0 KiB
#include "game.h" const int maxN = 3e5 + 20; int max_in[maxN]; vector<int> adj[maxN]; int n, k; void init(int _n, int _k) { n = _n; k = _k; for (int i = 0; i < k; i++) { max_in[i] = i - 1; } for (int i = k; i < n; i++) { max_in[i] = -1; } } void dfs(int u) { for (auto v: adj[u]) { if (max_in[u] > max_in[v]) { max_in[v] = max_in[u]; dfs(v); } } } int add_teleporter(int u, int v) { int cur = max(max_in[u], (u < k ? u : -1)); if (cur > max_in[v]) { max_in[v] = cur; dfs(v); } adj[u].push_back(v); for (int i = 0; i < k; i++) { if (max_in[i] >= i) { return 1; } } return 0; }

Compilation message (stderr)

game.cpp:5:1: error: 'vector' does not name a type
    5 | vector<int> adj[maxN];
      | ^~~~~~
game.cpp: In function 'void dfs(int)':
game.cpp:20:15: error: 'adj' was not declared in this scope
   20 |  for (auto v: adj[u]) {
      |               ^~~
game.cpp: In function 'int add_teleporter(int, int)':
game.cpp:29:12: error: 'max' was not declared in this scope; did you mean 'maxN'?
   29 |  int cur = max(max_in[u], (u < k ? u : -1));
      |            ^~~
      |            maxN
game.cpp:34:2: error: 'adj' was not declared in this scope
   34 |  adj[u].push_back(v);
      |  ^~~