# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
791870 | caganyanmaz | Game (IOI14_game) | C++14 | 1085 ms | 12820 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 <bits/stdc++.h>
#include "game.h"
using namespace std;
constexpr static int MXSIZE = 1500;
int ans[MXSIZE][MXSIZE];
set<int> g[MXSIZE];
int nc[MXSIZE];
bitset<MXSIZE> visited;
int n;
void initialize(int nn)
{
n = nn;
for (int i = 0; i < n; i++)
for (int j = 0; j < n; j++)
if (i != j)
g[i].insert(j);
}
void dfs(int i)
{
visited[i] = 1;
for (int c : g[i])
if (!visited[c])
dfs(c);
}
int hasEdge(int u, int v)
{
g[u].erase(v);
g[v].erase(u);
visited.reset();
dfs(0);
if (visited.count() == n)
return 0;
g[u].insert(v);
g[v].insert(u);
return 1;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |