제출 #398948

#제출 시각아이디문제언어결과실행 시간메모리
398948shrimb경찰관과 강도 (BOI14_coprobber)C++17
컴파일 에러
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); } } return 0; } 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; } }

컴파일 시 표준 에러 (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]) {
      |               ^~~