Submission #739846

#TimeUsernameProblemLanguageResultExecution timeMemory
739846dubabubaGame (APIO22_game)C++17
Compilation error
0 ms0 KiB
#include "game.h" #include <bits/stdc++.h> const int mxn = 3e5 + 10; const int mxm = 5e5 + 10; vector<int> adj[mxn]; vector<int> rev[mxn]; int n, k; int cnt_e[mxn], cnt_b[mxn]; vector<int> top; void tsort() { int t[mxn]; top.cleat(); queue<int> q; for(int i = 0; i < n; i++) { t[i] = cnt_e[i]; if(t[i] == 0) q.push(i); } while(q.size()) { int u = q.top(); top.push_back(u); q.pop(); for(int v : adj[u]) { t[v]--; if(t[v] == 0) q.push(v); } } } void init(int N, int K) { n = N; k = K; } bool in_top[mxn]; int add_teleporter(int u, int v) { adj[u].push_back(v); rev[v].push_back(u); cnt_b[u]++; cnt_e[v]++; tsort(); if(top.size() == n) return 0; memset(in_top, 0, sizeof in_top); for(int u : top) in_top[u] = 1; for(int i = 0; i < k; i++) if(!in_top[i]) return 1; return 0; }

Compilation message (stderr)

game.cpp:6:1: error: 'vector' does not name a type
    6 | vector<int> adj[mxn];
      | ^~~~~~
game.cpp:7:1: error: 'vector' does not name a type
    7 | vector<int> rev[mxn];
      | ^~~~~~
game.cpp:12:1: error: 'vector' does not name a type
   12 | vector<int> top;
      | ^~~~~~
game.cpp: In function 'void tsort()':
game.cpp:15:3: error: 'top' was not declared in this scope
   15 |   top.cleat();
      |   ^~~
game.cpp:17:3: error: 'queue' was not declared in this scope; did you mean 'std::queue'?
   17 |   queue<int> q;
      |   ^~~~~
      |   std::queue
In file included from /usr/include/c++/10/queue:64,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:86,
                 from game.cpp:2:
/usr/include/c++/10/bits/stl_queue.h:96:11: note: 'std::queue' declared here
   96 |     class queue
      |           ^~~~~
game.cpp:17:9: error: expected primary-expression before 'int'
   17 |   queue<int> q;
      |         ^~~
game.cpp:21:7: error: 'q' was not declared in this scope
   21 |       q.push(i);
      |       ^
game.cpp:24:9: error: 'q' was not declared in this scope
   24 |   while(q.size()) {
      |         ^
game.cpp:29:17: error: 'adj' was not declared in this scope
   29 |     for(int v : adj[u]) {
      |                 ^~~
game.cpp: In function 'int add_teleporter(int, int)':
game.cpp:44:3: error: 'adj' was not declared in this scope
   44 |   adj[u].push_back(v);
      |   ^~~
game.cpp:45:3: error: 'rev' was not declared in this scope
   45 |   rev[v].push_back(u);
      |   ^~~
game.cpp:50:6: error: 'top' was not declared in this scope
   50 |   if(top.size() == n)
      |      ^~~
game.cpp:54:15: error: 'top' was not declared in this scope
   54 |   for(int u : top)
      |               ^~~