Submission #71350

#TimeUsernameProblemLanguageResultExecution timeMemory
71350someone_aaCop and Robber (BOI14_coprobber)C++17
0 / 100
249 ms22268 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 curr; 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; } curr = ind; return ind; } bool vis[maxn][maxn]; int nextMove(int R) { vis[curr][R] = true; if(curr == R) return curr; else { for(int i=0;i<n;i++) { if(a[curr][i] && recursion(i, R, 1) && !vis[i][R]) { return i; } } } }

Compilation message (stderr)

coprobber.cpp: In function 'int nextMove(int)':
coprobber.cpp:69:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...