Submission #938447

#TimeUsernameProblemLanguageResultExecution timeMemory
938447Ghulam_JunaidCop and Robber (BOI14_coprobber)C++17
0 / 100
149 ms262144 KiB
#include <bits/stdc++.h> using namespace std; #define MAX_N 500 // modify the following functions // you can define global variables and functions int n, dist[MAX_N][MAX_N]; bool edge[MAX_N][MAX_N]; void dfs(int v, int s, int p = -1){ for (int u = 0; u < n; u ++) if (u != p and edge[v][u]){ dist[s][u] = dist[s][v] + 1; dfs(u, s, v); } } 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 ++) edge[i][j] = A[i][j]; for (int i = 0; i < n; i ++) dfs(i, i); return 0; } int cur = 0; int nextMove(int R) { if (dist[cur][R] == 1) return cur; for (int i = 0; i < n; i ++){ if (dist[cur][i] == 1 and dist[i][R] < dist[cur][R]) return i; } return -1; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...