#include "coprobber.h"
#include <bits/stdc++.h>
using namespace std;
#define MAX_N 500
int cop = 0;
vector<int> pr(MAX_N+1, -2);
bool a[MAX_N][MAX_N];
void dfs(int u) {
for (int i = 0; i < MAX_N; ++i) {
if (a[u][i] == false)continue;
if (pr[i] == -2) {
pr[i] = u;
dfs(i);
}
}
}
// modify the following functions
// you can define global variables and functions
int start(int N, bool A[MAX_N][MAX_N]) {
pr[0] = -1;
for (int i = 0; i < MAX_N; ++i) {
for (int j = 0; j < MAX_N; ++j)
a[i][j] = A[i][j];
}
dfs(0);
return -1;
}
int nextMove(int R) {
int pos = R;
while (pr[pos] != cop) {
pos = pr[pos];
}
cop = pos;
return pos;
}
# | 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... |