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 "coprobber.h"
#include <bits/stdc++.h>
using namespace std;
int L, C, N;
int pos = 0;
int pere[502];
int A[502][502];
void dfs(int i)
{
for (int nouv = 0; nouv < N; nouv ++)
{
if (!A[i][nouv]) continue;
if (pere[nouv] == -2)
{
pere[nouv] = i;
dfs(nouv);
}
}
}
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];
for (int i = 0; i < N; i ++) pere[i] = -2;
pere[0] = -1;
dfs(0);
return 0;
}
int nextMove(int R)
{
int rob = R;
while (pere[rob] != pos)
{
rob = pere[rob];
}
pos = rob;
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... |