Submission #398895

#TimeUsernameProblemLanguageResultExecution timeMemory
398895almothana05Cop and Robber (BOI14_coprobber)C++14
0 / 100
180 ms262148 KiB
#include "coprobber.h" #include<iostream> #include<vector> #include<algorithm> using namespace std; int menge = 0 , jet = 0 , r = 0; int cmp = 0 ; bool done = 0; vector<vector<int> >num ; vector<vector<bool> > a; vector<int >vis(500+10 , 0), comp; int dfs(int x , int R){ cmp = 0; if(x == R){ r = 1; } vis[x] = 1; comp.push_back(x); for(int i = 0 ; i < num[x].size() ; i++){ if(vis[i] == 0 ){ cmp++; if( dfs(x , R) == -1){ return -1; } } } if(cmp == 0 && r == 1 ){ return -1; } comp.pop_back(); vis[x] = 0; } int start(int N, bool A[MAX_N][MAX_N]) { for(int i = 0 ;i < N ; i++){ a.push_back(vector<bool>()); num.push_back(vector<int>()); for(int j = 0 ; j < N ; j++){ a[i].push_back(A[i][j]); if(a[i][j] == 1){ num[i].push_back(j); } } } menge = N; return 0; } int nextMove(int R) { if(R == jet){ return jet; } if(num[jet][R] == 1){ return R; } else{ if(done == 0){ dfs(jet , R); reverse(comp.begin() , comp.end()); done = 1; } cmp = comp[comp.size() - 1]; comp.pop_back(); return cmp; } return jet; }

Compilation message (stderr)

coprobber.cpp: In function 'int dfs(int, int)':
coprobber.cpp:20:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   20 |  for(int i = 0 ; i < num[x].size() ; i++){
      |                  ~~^~~~~~~~~~~~~~~
coprobber.cpp:32:9: warning: control reaches end of non-void function [-Wreturn-type]
   32 |  vis[x] = 0;
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...