Submission #709788

#TimeUsernameProblemLanguageResultExecution timeMemory
709788ngano_upat_naGame (APIO22_game)C++17
Compilation error
0 ms0 KiB
#include "game.h" #include "bits/stdc++.h" using namespace std; using ll = long long; int N = 300000; int K = -1; bool done = false; bool cyc = false; vector<int> adj[N]; vector<bool> vis(N,false); void dfs(int u) { if (vis[u]) { cyc = true; return; } vis[u] = true; for (auto &v:adj[u]) { dfs(v); } } void init(int n, int k) { N = n; K = k; for (int i=0; i<=k-2; i++) { adj[i].push_back(i+1); } } int add_teleporter(int u, int v) { adj[u].push_back(v); if (done) return 1; for (int i=0; i<N; i++) { vis[i] = false; } cyc = false; dfs(0); if (cyc) return 1; return 0; }

Compilation message (stderr)

game.cpp:10:18: error: array bound is not an integer constant before ']' token
   10 | vector<int> adj[N];
      |                  ^
game.cpp: In function 'void dfs(int)':
game.cpp:19:18: error: 'adj' was not declared in this scope
   19 |     for (auto &v:adj[u]) {
      |                  ^~~
game.cpp: In function 'void init(int, int)':
game.cpp:29:9: error: 'adj' was not declared in this scope
   29 |         adj[i].push_back(i+1);
      |         ^~~
game.cpp: In function 'int add_teleporter(int, int)':
game.cpp:34:5: error: 'adj' was not declared in this scope
   34 |     adj[u].push_back(v);
      |     ^~~