제출 #841840

#제출 시각아이디문제언어결과실행 시간메모리
841840manizare경찰관과 강도 (BOI14_coprobber)C++14
컴파일 에러
0 ms0 KiB
#include<bits/stdc++.h> #include "coprobber.h" using namespace std; #define pb push_back #define ll long long #define ff first #define ss second #define all(s) s.begin(),s.end() int cnt = 0 , dis[500] , par[500] , st[500] , en[500] , cur = 0 , par[500] ; vector <int> G[500] ; void dfs(int v , int p = -1){ st[v] = cnt ; cnt++; for(int i =0 ; i < (int)G[v].size() ; i++){ int u = G[v][i] ; if(u== p)continue ; dis[u] = dis[v] + 1; dfs(u , v) ; } en[v] = cnt ; cnt ++ ; } int start(int n,bool a[500][500]){ for(int i = 0 ; i < n ; i++){ for(int j =0 ; j < n; j++){ if(a[i][j])G[i].pb(j) ; } } dfs(0) ; return 0; } int ch(int v , int u){ if(st[u] >= st[v] && en[v] >= en[u]){ return 1; } return 0 ; } int nextMove(int r){ if(p[r]==cur){ return cur; } while(p[r]!=cur){ r=p[r]; } return cur=r; }

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

coprobber.cpp:12:69: error: redefinition of 'int par [500]'
   12 | int cnt = 0  , dis[500] , par[500] , st[500] , en[500] , cur = 0  , par[500] ;
      |                                                                     ^~~
coprobber.cpp:12:27: note: 'int par [500]' previously declared here
   12 | int cnt = 0  , dis[500] , par[500] , st[500] , en[500] , cur = 0  , par[500] ;
      |                           ^~~
coprobber.cpp: In function 'int nextMove(int)':
coprobber.cpp:40:8: error: 'p' was not declared in this scope
   40 |     if(p[r]==cur){
      |        ^
coprobber.cpp:43:11: error: 'p' was not declared in this scope
   43 |     while(p[r]!=cur){
      |           ^