#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 (edge[cur][i] and dist[i][R] < dist[cur][R])
return i;
}
return cur;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
2392 KB |
Output is correct |
2 |
Correct |
1 ms |
2392 KB |
Output is correct |
3 |
Incorrect |
1 ms |
2392 KB |
the situation repeated |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
146 ms |
262144 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
2392 KB |
Output is correct |
2 |
Correct |
1 ms |
2392 KB |
Output is correct |
3 |
Incorrect |
1 ms |
2392 KB |
the situation repeated |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
2392 KB |
Output is correct |
2 |
Correct |
1 ms |
2392 KB |
Output is correct |
3 |
Incorrect |
1 ms |
2392 KB |
the situation repeated |
4 |
Halted |
0 ms |
0 KB |
- |