Submission #1186577

#TimeUsernameProblemLanguageResultExecution timeMemory
1186577versesrevGame (IOI14_game)C++20
Compilation error
0 ms0 KiB
#include <deque> int n{}; std::vector<std::vector<bool>> edges; void initialize(int _n) { n = _n; edges.assign(n, std::vector<bool>(n, true)); for (int i = 0; i < n; ++i) { edges[i][i] = false; } } int hasEdge(int u, int v) { edges[u][v] = edges[v][u] = false; std::deque<int> queue; std::vector<bool> visited(n); int count = 0; queue.push_back(u), visited[u] = true, ++count; while (not queue.empty()) { int cur = queue.front(); queue.pop_front(); for (int nxt = 0; nxt < n; ++nxt) { if (edges[cur][nxt] and not visited[nxt]) { queue.push_back(nxt), visited[nxt], ++count; } } } if (count != n) { edges[u][v] = edges[v][u] = true; } return edges[u][v]; }

Compilation message (stderr)

game.cpp:4:6: error: 'vector' in namespace 'std' does not name a template type
    4 | std::vector<std::vector<bool>> edges;
      |      ^~~~~~
game.cpp:2:1: note: 'std::vector' is defined in header '<vector>'; did you forget to '#include <vector>'?
    1 | #include <deque>
  +++ |+#include <vector>
    2 | 
game.cpp: In function 'void initialize(int)':
game.cpp:8:3: error: 'edges' was not declared in this scope
    8 |   edges.assign(n, std::vector<bool>(n, true));
      |   ^~~~~
game.cpp:8:24: error: 'vector' is not a member of 'std'
    8 |   edges.assign(n, std::vector<bool>(n, true));
      |                        ^~~~~~
game.cpp:8:24: note: 'std::vector' is defined in header '<vector>'; did you forget to '#include <vector>'?
game.cpp:8:31: error: expected primary-expression before 'bool'
    8 |   edges.assign(n, std::vector<bool>(n, true));
      |                               ^~~~
game.cpp: In function 'int hasEdge(int, int)':
game.cpp:15:3: error: 'edges' was not declared in this scope
   15 |   edges[u][v] = edges[v][u] = false;
      |   ^~~~~
game.cpp:18:8: error: 'vector' is not a member of 'std'
   18 |   std::vector<bool> visited(n);
      |        ^~~~~~
game.cpp:18:8: note: 'std::vector' is defined in header '<vector>'; did you forget to '#include <vector>'?
game.cpp:18:15: error: expected primary-expression before 'bool'
   18 |   std::vector<bool> visited(n);
      |               ^~~~
game.cpp:20:23: error: 'visited' was not declared in this scope
   20 |   queue.push_back(u), visited[u] = true, ++count;
      |                       ^~~~~~~