제출 #958770

#제출 시각아이디문제언어결과실행 시간메모리
958770teo_thrash경찰관과 강도 (BOI14_coprobber)C++14
컴파일 에러
0 ms0 KiB
#include "coprobber.h" vector<int> nbrs[MAX_N]; int curr=0; 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]){ nbrs[i].pb(j); nbrs[j].pb(i); } } } return 0; } int dfs(int x, int y, int to){ if(x==to) return 0; for(auto u: nbrs[x]){ if(u==y) continue; int nas = dfs(u, x, to); if(nas!=-1){ return 1+nas; } } return -1; } int nextMove(int R){ int dist = dfs(curr, -1, R); for(auto u: nbrs[curr]){ if(dfs(u, -1, R)==dist-1){ return curr=u; } } return 0; }

컴파일 시 표준 에러 (stderr) 메시지

coprobber.cpp:3:1: error: 'vector' does not name a type
    3 | vector<int> nbrs[MAX_N];
      | ^~~~~~
coprobber.cpp: In function 'int start(int, bool (*)[500])':
coprobber.cpp:11:17: error: 'nbrs' was not declared in this scope
   11 |                 nbrs[i].pb(j);
      |                 ^~~~
coprobber.cpp: In function 'int dfs(int, int, int)':
coprobber.cpp:23:17: error: 'nbrs' was not declared in this scope
   23 |     for(auto u: nbrs[x]){
      |                 ^~~~
coprobber.cpp: In function 'int nextMove(int)':
coprobber.cpp:39:17: error: 'nbrs' was not declared in this scope
   39 |     for(auto u: nbrs[curr]){
      |                 ^~~~