제출 #419495

#제출 시각아이디문제언어결과실행 시간메모리
419495den_tar경찰관과 강도 (BOI14_coprobber)C++14
컴파일 에러
0 ms0 KiB
#include "coprobber.h" #include <bits/stdc++.h> typedef long long ll; const ll DIM = 5e2 + 7; vector<ll> a[DIM]; ll vis[DIM]; ll n,fl; ll police; void dfs(ll v,ll p){ vis[v]=1; for(auto to:a[v]){ if(vis[to]==2 || to==p)continue; if(vis[to]==1){ fl=1; return; } dfs(to,v); if(fl==1)return; } vis[v]=2; } void dfs1(ll v,ll d){ vis[v]=d; for(auto to:a[v]) if(vis[to]==(-1))dfs1(to,d+1); } int start(int N, bool A[MAX_N][MAX_N]) { n=N; for(int i=0;i<n;i++) for(int j=0;j<n;j++) if(A[i][j])a[i].push_back(j); dfs(0,(-1)); if(fl==1)return -1; police=0; return police; } int nextMove(int R) { for(int i=0;i<n;i++)vis[i]=(-1); dfs1(R,0); if(vis[police]>1){ for(auto to:a[police]){ if(vis[to]<vis[police]){ police=to; break; } } } return police; }

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

coprobber.cpp:9:1: error: 'vector' does not name a type
    9 | vector<ll> a[DIM];
      | ^~~~~~
coprobber.cpp: In function 'void dfs(ll, ll)':
coprobber.cpp:21:17: error: 'a' was not declared in this scope
   21 |     for(auto to:a[v]){
      |                 ^
coprobber.cpp: In function 'void dfs1(ll, ll)':
coprobber.cpp:38:18: error: 'a' was not declared in this scope
   38 |      for(auto to:a[v])
      |                  ^
coprobber.cpp: In function 'int start(int, bool (*)[500])':
coprobber.cpp:49:18: error: 'a' was not declared in this scope
   49 |       if(A[i][j])a[i].push_back(j);
      |                  ^
coprobber.cpp: In function 'int nextMove(int)':
coprobber.cpp:68:18: error: 'a' was not declared in this scope
   68 |      for(auto to:a[police]){
      |                  ^