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;
const int MAXN = 2048;
int n;
int H[MAXN][MAXN];
void initialize(int _n) {
n = _n;
for (int i = 0; i < n; i++){
for (int j = 0; j < n; j++){
H[i][j] = i != j;
}
}
}
bool used[MAXN];
void dfs(int v){
used[v] = true;
for (int u = 0; u < n; u++){
if (!used[u] && H[v][u]) dfs(u);
}
}
int hasEdge(int u, int v) {
fill(used, used + n, false);
H[u][v] = H[v][u] = 0;
dfs(v);
H[u][v] = H[v][u] = 1;
if (used[u]){ /// NO
H[u][v] = H[v][u] = 0;
return 0;
}
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... |