# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|
105023 | | WLZ | Game (IOI14_game) | C++17 | | 1085 ms | 12792 KiB |
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< set<int> > g;
vector<int> was;
void initialize(int n) {
g.resize(n);
for (int i = 0; i < n; i++) {
for (int j = 0; j < n; j++) {
if (i != j) {
g[i].insert(j);
}
}
}
}
void dfs(int u) {
was[u] = 1;
for (auto& v : g[u]) {
if (!was[v]) {
dfs(v);
}
}
}
int hasEdge(int u, int v) {
if (g[u].count(v)) {
g[u].erase(v);
g[v].erase(u);
}
was.assign((int) g.size(), 0);
dfs(u);
if (was[v]) {
return 0;
}
g[u].insert(v);
g[v].insert(u);
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... |