Submission #136029

#TimeUsernameProblemLanguageResultExecution timeMemory
136029forelaxCop and Robber (BOI14_coprobber)C++14
Compilation error
0 ms0 KiB
#include "coprobber.h" #include<bits/stdc++.h> using namespace std; vector<vector<bool> > wing(500,vector<bool> (500)); vector<vector<int> > cntl(500,vector<int> (500)); vector<vector<int> > go(500,vector<int> (500)); vector<vector<bool> > a(500,vector<bool> (500)); vector<vector<int> > edge(500,vector<int> (500)); vector<int> eds(500); int n,cr=0; int start(int _N,bool A[500][500]){ n=_N; queue<vector<int> > q; for(int i = 0 ; i < n ; i ++){ for(int j = 0 ; j < n ; j ++){ a[i][j]=A[i][j]; if(a[i][j]){ edge[i][eds[i]++]=j; wing[i][j]=true; q.push({0,i,j}); go[i][j]=j; } } } for(int i = 0 ; i < n ; i ++){ for(int j = 0 ; j < n ; j ++){ if(i==j)continue; cntl[i][j]=edge[j].size(); if(a[j][i])cntl[i][j]--; if(cntl[i][j])continue; q.push({1,y,ne}); } } while(q.size()){ vector<int> nw=q.front(); q.pop(); int x=nw[2]; int y=nw[1]; int st=nw[0]; if(st==0){ for(int i = 0 ; i < eds[x] ; i ++){ int ne=edge[x][i]; if(ne==y)continue; cntl[y][ne]--; if(cntl[y][ne])continue; q.push({1,y,ne}); } }else{ for(int i = 0,ne ; i <= eds[y] ; i ++){ if(i<eds[y]ne=edge[y][i]; else ne=y; if(ne==x)continue; if(wing[ne][x])continue; go[ne][x]=y; wing[ne][x]=true; q.push({0,ne,x}); } } } cr=-1; // for(int i = 0 ; i < n ; i ++){ // for(int j = 0 ; j < n ; j ++){ // cout<<wing[i][j]; // }cout<<endl;}cout<<endl; for(int i = 0 ; i < n ; i ++){ bool good=true; for(int j = 0 ; j < n ; j ++){ if(i==j)continue; if(!wing[i][j]){ good=false; break; } } if(!good)continue; cr=i; break; } // cout<<cr<<" "; return cr; } int nextMove(int np){ cr=go[cr][np]; // cout<<np<<" "<<cr<<" "<<endl; return cr; } //int main(){ // int N; // cin>>N; // bool A[500][500]; //// vector<vector<bool> > A(N,vector<bool> (N)); // for(int i = 0,g ; i < N ;i ++){ // for(int j = 0 ; j < N ; j ++){ // cin>>g; // A[i][j]=g; // } // } // int CP=start(N,A),one; // cin>>one; // vector<vector<int> > dir(n,vector<int> (n+1)); // for(int i = 0 ; i < N ; i ++) // for(int j = 0 ; j <= N ; j ++) // cin>>dir[i][j]; // int BP=dir[CP].back(); // while(CP!=BP){ // cout<<CP<<" "<<BP<<" "; // BP=dir[CP][BP]; // CP=nextMove(BP); // } // cout<<CP<<" "<<BP; //}

Compilation message (stderr)

coprobber.cpp: In function 'int start(int, bool (*)[500])':
coprobber.cpp:31:23: error: 'y' was not declared in this scope
             q.push({1,y,ne});
                       ^
coprobber.cpp:31:25: error: 'ne' was not declared in this scope
             q.push({1,y,ne});
                         ^~
coprobber.cpp:31:25: note: suggested alternative: 'n'
             q.push({1,y,ne});
                         ^~
                         n
coprobber.cpp:31:28: error: no matching function for call to 'std::queue<std::vector<int> >::push(<brace-enclosed initializer list>)'
             q.push({1,y,ne});
                            ^
In file included from /usr/include/c++/7/queue:64:0,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:86,
                 from coprobber.cpp:2:
/usr/include/c++/7/bits/stl_queue.h:251:7: note: candidate: void std::queue<_Tp, _Sequence>::push(const value_type&) [with _Tp = std::vector<int>; _Sequence = std::deque<std::vector<int>, std::allocator<std::vector<int> > >; std::queue<_Tp, _Sequence>::value_type = std::vector<int>]
       push(const value_type& __x)
       ^~~~
/usr/include/c++/7/bits/stl_queue.h:251:7: note:   no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'const value_type& {aka const std::vector<int>&}'
/usr/include/c++/7/bits/stl_queue.h:256:7: note: candidate: void std::queue<_Tp, _Sequence>::push(std::queue<_Tp, _Sequence>::value_type&&) [with _Tp = std::vector<int>; _Sequence = std::deque<std::vector<int>, std::allocator<std::vector<int> > >; std::queue<_Tp, _Sequence>::value_type = std::vector<int>]
       push(value_type&& __x)
       ^~~~
/usr/include/c++/7/bits/stl_queue.h:256:7: note:   no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'std::queue<std::vector<int> >::value_type&& {aka std::vector<int>&&}'
coprobber.cpp:50:20: warning: init-statement in selection statements only available with -std=c++1z or -std=gnu++1z
                 if(i<eds[y]ne=edge[y][i];
                    ^
coprobber.cpp:50:28: error: expected ';' before 'ne'
                 if(i<eds[y]ne=edge[y][i];
                            ^~
coprobber.cpp:50:21: warning: value computed is not used [-Wunused-value]
                 if(i<eds[y]ne=edge[y][i];
coprobber.cpp:51:17: error: expected primary-expression before 'else'
                 else ne=y;
                 ^~~~
coprobber.cpp:51:17: error: expected ')' before 'else'