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 "game.h"
#include <bits/stdc++.h>
using namespace std;
vector< vector<int> > g;
vector<int> was;
void initialize(int n) {
g.assign(n, vector<int>(n, 1));
for (int i = 0; i < n; i++) {
for (int j = 0; j < n; j++) {
if (i == j) {
g[i][j] = 0;
}
}
}
}
void dfs(int u) {
was[u] = 1;
for (int v = 1; v < (int) g[u].size(); v++) {
if (g[u][v] && !was[v]) {
dfs(v);
}
}
}
int hasEdge(int u, int v) {
g[u][v] = g[v][u] = 0;
was.assign((int) g.size(), 0);
dfs(u);
if (was[v]) {
return 0;
}
g[u][v] = g[v][u] = 1;
return 1;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |