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 <iostream>
#include <vector>
#include "game.h"
using namespace std;
int n;
vector <vector <bool>> e(1500, vector <bool>(1500, true));
vector <bool> volt(1500, false);
void dfs(int x) {
if (volt[x]) return;
volt[x] = true;
for (int i = 0; i < n; i++) if (e[x][i]) dfs(i);
}
void initialize(int N) {
n = N;
}
int hasEdge(int u, int v) {
e[u][v] = e[v][u] = false;
fill(volt.begin(), volt.begin() + n, false);
dfs(u);
if (!volt[v]) e[u][v] = e[v][u] = true;
return e[u][v];
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |