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<set>
int n;
std::set<int> s[1500];
int e[1500][1500];
void initialize(int N)
{
n=N;
for(int i=0;i<N;i++)
for(int j=0;j<N;j++)
if(i!=j) s[i].insert(j);
}
int hasEdge(int a,int b)
{
if(s[a].find(b)==s[a].end()) return e[a][b];
s[a].erase(b); s[b].erase(a);
while(s[a].size()==1)
{
int next=*s[a].begin();
e[a][next]=e[next][a]=1;
s[a].erase(next); s[next].erase(a);
a=next;
}
while(s[b].size()==1)
{
int next=*s[b].begin();
e[b][next]=e[next][b]=1;
s[b].erase(next); s[next].erase(b);
b=next;
}
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |