Submission #418113

#TimeUsernameProblemLanguageResultExecution timeMemory
418113amunduzbaevCop and Robber (BOI14_coprobber)C++14
0 / 100
1 ms328 KiB
#include "coprobber.h" #include "bits/stdc++.h" #ifndef EVAL #include "grader.cpp" #endif using namespace std; const int MAXN = 500; int n, m, x, y, tin[MAXN], tout[MAXN], t; int a[MAXN][MAXN], par[MAXN], cur; void dfs(int u, int p = -1){ par[u] = p, tin[u] = t++; for(int i=0;i<n;i++){ if(a[u][i] && i != p) dfs(i, u); } tout[u] = t - 1; } 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]; } return 0; } int nextMove(int r){ if(tin[cur] <= tin[r] && tout[r] <= tout[cur]){ for(int i=0;i<n;i++){ if(a[cur][i] && par[cur] != i){ if(tin[i] <= tin[r] && tout[r] <= tout[i]){ cur = i; return i; } } } } else cur = par[cur]; return par[cur]; //~ int tx = r / m, ty = r % m; //~ int xd = abs(tx - x), yd = abs(ty - y); //~ if(xd > yd){ //~ if(tx > x) x++; //~ else x--; //~ } if(xd < yd){ //~ if(ty > y) y++; //~ else y--; //~ } return x * m + y; } /* 9 0 1 0 1 0 0 0 0 0 1 0 1 0 1 0 0 0 0 0 1 0 0 0 1 0 0 0 1 0 0 0 1 0 1 0 0 0 1 0 1 0 1 0 1 0 0 0 1 0 1 0 0 0 1 0 0 0 1 0 0 0 1 0 0 0 0 0 1 0 1 0 1 0 0 0 0 0 1 0 1 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...