This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
// #pragma once
#include <map>
#include "game.h"
using namespace std;
const int N=100;
int deg[N];
map<pair<int,int>,int> done;
int l=0;
void initialize(int n)
{
l=(n*(n-1))/2;
done.clear();
for(int i=0;i<=n;i++)
deg[i]=n-1;
}
int hasEdge(int u, int v)
{
l--;
if(l==0)
return 0;
if(done.find({u,v})==done.end())
{
deg[u]--;
deg[v]--;
if(deg[u]==0 or deg[v]==0)
{
done[{u,v}]=done[{v,u}]=1;
}
else
{
done[{u,v}]=done[{v,u}]=0;
}
}
return done[{u,v}];
// We have
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |