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;
int n;
void initialize(int N) {
n=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);
}
int hasEdge(int u, int v) {
g[u].erase(g[u].find(v));
g[v].erase(g[v].find(u));
queue<int> q;
q.emplace(u);
vector<bool> s(n,0);
while(!q.empty()){
int t=q.front();
q.pop();
if(s[t]) continue;
s[t]=1;
if(t==v) return 0;
for(auto i: g[t]) if(!s[i]) q.emplace(i);
}
g[u].emplace(v);
g[v].emplace(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... |