#include "coprobber.h"
#include <bits/stdc++.h>
using namespace std;
const int nx=505;
int in[nx], out[nx], pa[nx], t, cur;
vector<int> d[nx];
void dfs(int u, int p)
{
pa[u]=p;
in[u]=++t;
for (auto v:d[u]) if (v!=p) dfs(v, u);
out[u]=t;
}
int start(int N, bool A[MAX_N][MAX_N])
{
for (int i=0; i<N; i++) for (int j=0; j<N; j++) if (A[i][j]) d[i].push_back(j), d[j].push_back(i);
dfs(0, 0);
return 0;
}
int nextMove(int R)
{
if (R==cur) return R;
for (auto v:d[cur]) if (v!=pa[cur]&&in[v]<=in[R]&&out[R]<=out[v]) return cur=v;
}
Compilation message (stderr)
coprobber.cpp: In function 'int nextMove(int)':
coprobber.cpp:30:1: warning: control reaches end of non-void function [-Wreturn-type]
30 | }
| ^
# | 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... |