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;
int n;
vector<set<int> > g;
map<pair<int,int>,bool> m;
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) continue;
g[i].insert(j);
}
}
}
int hasEdge(int u,int v)
{
if(m.find({u,v})!=m.end()) return m[{u,v}];
if(g[u].size()==1 || g[v].size()==1)
{
m[{u,v}]=m[{v,u}]=1;
g[u].erase(v);
g[v].erase(u);
return 1;
}else
{
m[{u,v}]=m[{v,u}]=0;
g[u].erase(v);
g[v].erase(u);
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... |