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 = 1.5e3 + 20;
vector<int> adj[maxn];
int q[maxn];
int flag[maxn];
int t;
void initialize(int n) {
for (int i = 0; i < n; i++) {
for (int j = 0; j < n; j++) {
if (j != i) {
adj[i].push_back(j);
}
}
}
}
int hasEdge(int u, int v) {
t++;
adj[u].erase(find(adj[u].begin(), adj[u].end(), v));
adj[v].erase(find(adj[v].begin(), adj[v].end(), u));
int pt = 0;
int sz = 1;
q[pt] = u;
flag[u] = t;
while (pt < sz) {
int x = q[pt++];
for (auto y: adj[x]) {
if (y == v) {
return 0;
}
if (flag[y] != t) {
flag[y] = t;
q[sz++] = y;
}
}
}
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... |