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;
#define all(x) (x).begin(),(x).end()
const int MAXN = 1e6 + 10;
int n;
vector<int> adj[MAXN];
bool vis[MAXN];
void initialize(int n_) {
n = n_;
for (int i = 0; i < n; i++)
for (int j = 0; j < n; j++)
if (i != j)
adj[i].push_back(j);
}
void dfs(int v) {
vis[v] = true;
for (int u : adj[v])
if (!vis[u])
dfs(u);
}
int hasEdge(int u, int v) {
adj[u].erase(find(all(adj[u]), v));
adj[v].erase(find(all(adj[v]), u));
for (int i = 0; i < n; i++) vis[i] = false;
dfs(1);
bool flag = true;
for (int i = 0; i < n; i++)
if (!vis[i])
flag = false;
if (flag) return 0;
adj[u].push_back(v);
adj[v].push_back(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... |