# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
398895 | 2021-05-04T21:56:51 Z | almothana05 | Cop and Robber (BOI14_coprobber) | C++14 | 180 ms | 262148 KB |
#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
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 1 ms | 456 KB | Execution killed with signal 6 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 180 ms | 262148 KB | Execution killed with signal 9 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 1 ms | 456 KB | Execution killed with signal 6 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 1 ms | 456 KB | Execution killed with signal 6 |
2 | Halted | 0 ms | 0 KB | - |