Submission #398974

#TimeUsernameProblemLanguageResultExecution timeMemory
398974shrimb경찰관과 강도 (BOI14_coprobber)C++17
Compilation error
0 ms0 KiB
#include "coprobber.h" vector<int> adj[501]; int cur = 0, nig; int start(int N, bool A[MAX_N][MAX_N]) { for (int i = 0 ; i < N ; i++) { for (int j = 0 ; j < N ; j++) { if (A[i][j]) adj[i].push_back(j); } } if (N < 9) return -1; } bool check (int c, int p) { bool res = 0; for (int i : adj[c]) { if (i == nig) return 1; res |= check(i, c); } return res; } int nextMove(int R) { nig = R; for (int i : adj[cur]) { if (i == R || check(i, cur)) return cur = i; } return -1; }

Compilation message (stderr)

coprobber.cpp:2:1: error: 'vector' does not name a type
    2 | vector<int> adj[501];
      | ^~~~~~
coprobber.cpp: In function 'int start(int, bool (*)[500])':
coprobber.cpp:8:17: error: 'adj' was not declared in this scope
    8 |    if (A[i][j]) adj[i].push_back(j);
      |                 ^~~
coprobber.cpp: In function 'bool check(int, int)':
coprobber.cpp:16:15: error: 'adj' was not declared in this scope
   16 |  for (int i : adj[c]) {
      |               ^~~
coprobber.cpp: In function 'int nextMove(int)':
coprobber.cpp:25:15: error: 'adj' was not declared in this scope
   25 |  for (int i : adj[cur]) {
      |               ^~~
coprobber.cpp: In function 'int start(int, bool (*)[500])':
coprobber.cpp:12:1: warning: control reaches end of non-void function [-Wreturn-type]
   12 | }
      | ^