제출 #103517

#제출 시각아이디문제언어결과실행 시간메모리
103517pedro_sponchiado경찰관과 강도 (BOI14_coprobber)C++17
컴파일 에러
0 ms0 KiB
#include "coprobber.h" const int maxn=510; vector<int> adj[maxn]; int d[maxn][maxn]; int marc[maxn]; queue<int> pilha; vector<pair<int, pair<int, int> > > ord_d; int aux[maxn][maxn]; int seta[maxn][maxn]; int p; void bfs(int u, int ini){ marc[u]=1; for(int i=0; i<adj[u].size(); i++){ int v=adj[u][i]; if(marc[v]==0){ d[v][ini]=d[u][ini]+1; pilha.push(v); } } pilha.pop(); return; } int start(int n, bool A[maxn][maxn]){ for(int i=1; i<=n; i++){ for(int k=1; k<=n; k++){ if(A[i][k]) adj[i].push_back(k); } } //calcula as distancias for(int i=1; i<=n; i++){ for(int k=1; k<=n; k++){ marc[k]=0; } pilha.push(i); while(!pilha.empty())) bfs(pilha.front(), i); } //ordena pela distancia for(int i=1; i<=n; i++){ for(int k=1; k<=n; k++){ ord_d.push_back(make_pair(d[i][k], make_pair(i, k))); } } sort(ord_d.begin(), ord_d.end()); //calcula aux for(int i=1; i<=n; i++){ for(int k=1; k<=n; k++){ aux[i][k]=maxn; for(int t=0; t<adj[k].size(); t++){ int l=adj[k][t]; aux[i][k]=min(aux[i][k], d[i][l]); } } } //calcula pra cada nivel, quais são os caras que diminui distância, e p=0; return 0; } int nextMove(int r){ p=seta[p][r]; return p; }

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

coprobber.cpp:4:1: error: 'vector' does not name a type
 vector<int> adj[maxn];
 ^~~~~~
coprobber.cpp:7:1: error: 'queue' does not name a type
 queue<int> pilha;
 ^~~~~
coprobber.cpp:10:1: error: 'vector' does not name a type
 vector<pair<int, pair<int, int> > > ord_d;
 ^~~~~~
coprobber.cpp: In function 'void bfs(int, int)':
coprobber.cpp:19:17: error: 'adj' was not declared in this scope
  for(int i=0; i<adj[u].size(); i++){
                 ^~~
coprobber.cpp:23:4: error: 'pilha' was not declared in this scope
    pilha.push(v);
    ^~~~~
coprobber.cpp:26:2: error: 'pilha' was not declared in this scope
  pilha.pop();
  ^~~~~
coprobber.cpp: In function 'int start(int, bool (*)[510])':
coprobber.cpp:35:16: error: 'adj' was not declared in this scope
    if(A[i][k]) adj[i].push_back(k);
                ^~~
coprobber.cpp:43:3: error: 'pilha' was not declared in this scope
   pilha.push(i);
   ^~~~~
coprobber.cpp:44:24: error: expected primary-expression before ')' token
   while(!pilha.empty())) bfs(pilha.front(), i);
                        ^
coprobber.cpp:50:4: error: 'ord_d' was not declared in this scope
    ord_d.push_back(make_pair(d[i][k], make_pair(i, k)));
    ^~~~~
coprobber.cpp:50:39: error: 'make_pair' was not declared in this scope
    ord_d.push_back(make_pair(d[i][k], make_pair(i, k)));
                                       ^~~~~~~~~
coprobber.cpp:50:20: error: 'make_pair' was not declared in this scope
    ord_d.push_back(make_pair(d[i][k], make_pair(i, k)));
                    ^~~~~~~~~
coprobber.cpp:53:7: error: 'ord_d' was not declared in this scope
  sort(ord_d.begin(), ord_d.end());
       ^~~~~
coprobber.cpp:53:2: error: 'sort' was not declared in this scope
  sort(ord_d.begin(), ord_d.end());
  ^~~~
coprobber.cpp:53:2: note: suggested alternative: 'short'
  sort(ord_d.begin(), ord_d.end());
  ^~~~
  short
coprobber.cpp:59:19: error: 'adj' was not declared in this scope
    for(int t=0; t<adj[k].size(); t++){
                   ^~~
coprobber.cpp:61:15: error: 'min' was not declared in this scope
     aux[i][k]=min(aux[i][k], d[i][l]);
               ^~~
coprobber.cpp:61:15: note: suggested alternative: 'maxn'
     aux[i][k]=min(aux[i][k], d[i][l]);
               ^~~
               maxn