Submission #90224

#TimeUsernameProblemLanguageResultExecution timeMemory
90224nikolapesic2802Cop and Robber (BOI14_coprobber)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #include "coprobber.h" using namespace std; #define pb push_back vector<vector<int> > graph(MAX_N); int value[MAX_N][MAX_N][2]; int nxt[MAX_N][MAX_N]; int degree[MAX_N][MAX_N]; vector<array<int,3> > todo; int pos=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]) graph[i].pb(j); for(int i=0;i<N;i++) { for(int j=0;j<N;j++) { if(i==j) { todo.pb({i,j,0}); todo.pb({i,j,1}); value[i][j][0]=1; value[i][j][1]=1; continue; } for(auto p:graph[j]) degree[i][j][1]++; } } while(todo.size()) { vector<array<int,3> > futuretodo; for(auto d:todo){ int x=d[0],y=d[1],z=d[2]; if(z==1) { int i=x,j=y,k=0; if(value[i][j][k]==0) { value[i][j][k]=1; nxt[i][j]=x; futuretodo.pb({i,j,k}); } for(auto p:graph[x]) { i=p;j=y;k=0; if(value[i][j][k]==0) { value[i][j][k]=1; nxt[i][j]=x; futuretodo.pb({i,j,k}); } } } else { for(auto p:graph[y]) { int i=x,j=p,k=1; if(value[i][j][k]==0) { degree[i][j]--; if(degree[i][j]==0) { value[i][j][k]=1; futuretodo.pb({i,j,k}); } } } } } todo=futuretodo; } bool t=true; for(int i=1;i<N;i++) if(value[0][i][0]!=1) t=false; if(t) return 0; return -1; } int nextMove(int R) { return pos=nxt[pos][R]; }

Compilation message (stderr)

coprobber.cpp: In function 'int start(int, bool (*)[500])':
coprobber.cpp:31:31: error: invalid types 'int[int]' for array subscript
                 degree[i][j][1]++;
                               ^
coprobber.cpp:30:22: warning: unused variable 'p' [-Wunused-variable]
             for(auto p:graph[j])
                      ^