Submission #1075821

#TimeUsernameProblemLanguageResultExecution timeMemory
1075821antonCop and Robber (BOI14_coprobber)C++17
16 / 100
174 ms262144 KiB
#include "coprobber.h" #include<bits/stdc++.h> using namespace std; vector<vector<int>> ch; bool B[MAX_N][MAX_N]; int N; void dfs(int u, int a){ for(int i = 0; i<N; i++){ if(i!=a){ if(B[u][i]){ ch[u].push_back(i); dfs(i, u); } } } } int cop_pos= 0; int start(int _N, bool A[MAX_N][MAX_N]) { N= _N; ch.resize(N); for(int i = 0; i<MAX_N; i++){ for(int j = 0; j<MAX_N; j++){ B[i][j] = A[i][j]; } } dfs(0, -1); return 0; } int find_ch(int u, int target){ if(u == target){ return target; } else{ for(auto e: ch[u]){ int i =find_ch(e, target); if(i!=-1){ return e; } } } return -1; } int nextMove(int R) { cop_pos = find_ch(cop_pos, R); return cop_pos; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...