This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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];
void dfs(int v, int s, int p = -1){
for (int u = 0; u < n; u ++)
if (u != p){
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 ++)
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 time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |