Submission #71312

#TimeUsernameProblemLanguageResultExecution timeMemory
71312someone_aaCop and Robber (BOI14_coprobber)C++17
0 / 100
2 ms384 KiB
#include "coprobber.h" using namespace std; const int maxn = 510; bool visited[maxn][maxn][2]; bool dp[maxn][maxn][2]; bool a[maxn][maxn]; int n; /* t - 1: robber's turn t - 0: cop's turn */ bool recursion(int c, int r, int t) { if(visited[c][r][t]) return dp[c][r][t]; visited[c][r][t] = true; if(c==r) return dp[c][r][t] = true; if(t) { bool check = true; for(int i=0;i<n;i++) { if(a[r][i]) check &= recursion(c, i, 0); } return dp[c][r][t] = check; } else { bool check = recursion(c, r, 1); for(int i=0;i<n;i++) { if(a[c][i]) { check |= recursion(i, r, 1); } } return dp[c][r][t] = check; } } int start(int N, bool A[MAX_N][MAX_N]) { n = N; for(int i=0;i<N;i++) for(int j=0;j<N;j++) a[i][j] = A[i][j]; int ind = -1; for(int i=0;i<N;i++) { bool check = true; for(int j=0;j<N;j++) { if(!recursion(i, j, 0)) check = false; } if(check) ind = i; } return ind; } int nextMove(int R) { return 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...