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>
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define FORd(i, a, b) for (int i = (a); i >= (b); i--)
#define REP(i, n) FOR(i, 0, n)
#define ll long long
using namespace std;
int strategy;
int n;
vector <int> ve[MAX_N];
int D[MAX_N], F[MAX_N];
int disc = -1;
int P;
void rek(int x, int p) {
D[x] = ++disc;
for (int y : ve[x]) {
if (y == p) continue;
rek(y, x);
}
F[x] = disc;
return;
}
int start(int N, bool A[MAX_N][MAX_N]) {
n = N;
int e = 0;
REP(i, n) {
REP(j, n) {
if (A[i][j]) ve[i].push_back(j), e++;
}
}
e /= 2;
if (e == n - 1) {
rek(0, 0);
strategy = 0, P = 0;
return 0;
}
strategy = 1, P = 0;
return 0;
}
int nextMove(int R) {
if (strategy == 0) {
for (int x : ve[P]) {
if (D[x] < D[P]) continue;
if (D[x] <= D[R] && F[R] <= F[x]) {
P = x;
return x;
}
}
assert(0);
} else if (strategy == 1) {
} else {
assert(0);
}
return 0;
}
# | 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... |