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>
using namespace std;
bool used[80][80];
int n;
int p[80];
int find(int a) {
if (p[a]<0) {
return a;
}
return p[a]=find(p[a]);
}
void merge(int a,int b) {
a=find(a);
b=find(b);
if (a==b){
return;
}
p[a]+=p[b];
p[b]=a;
}
void initialize(int nn) {
n=nn;
}
int hasEdge(int u,int v) {
used[u][v]=true;
used[v][u]=true;
memset(p,-1,sizeof(p));
for(int i=0;i<n;i++) {
for(int j=i+1;j<n;j++) {
if (!used[i][j]) {
merge(i,j);
}
}
}
if (p[find(0)]==-n) {
return false;
}
else {
used[u][v]=false;
used[v][u]=false;
return true;
}
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |