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;
bool vis[1500];
int n;
set<int> edge[1500];
void dfs(int k)
{
vis[k] = true;
for (int i : edge[k])
if (!vis[i])
dfs(i);
}
void initialize(int N)
{
n = N;
for (int i = 0; i < n; i++)
for (int j = i + 1; j < n; j++)
edge[i].insert(j), edge[j].insert(i);
}
int hasEdge(int u, int v)
{
edge[u].erase(v), edge[v].erase(u);
for (int i = 0; i < n; i++)
vis[i] = false;
dfs(0);
bool con = true;
for (int i = 0; con && i < n; i++)
con = vis[i];
if (!con)
edge[u].insert(v), edge[v].insert(u);
return !con;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |