# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
270697 | daniel920712 | Game (IOI14_game) | C++14 | 614 ms | 25336 KiB |
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 <vector>
using namespace std;
int con=0,a,b,ok=0;
int Father[1505];
int sz[1505];
int how[1505][1505]={0},N;
vector < pair < int , int > > all;
int Find(int here)
{
if(Father[here]==here) return here;
Father[here]=Find(Father[here]);
return Father[here];
}
void initialize(int n)
{
int i;
N=n;
for(i=0;i<n;i++)
{
Father[i]=i;
sz[i]=1;
}
return ;
}
int hasEdge(int u, int v)
{
int con=0,i;
if(Find(u)==Find(v)) return 0;
if(how[Find(u)][Find(v)]==sz[Find(u)]*sz[Find(v)]-1)
{
how[Find(u)][Find(v)]++;
how[Find(v)][Find(u)]++;
for(i=0;i<N;i++)
{
how[Find(u)][i]+=how[Find(v)][i];
how[i][Find(u)]=how[Find(u)][i];
}
sz[Find(u)]+=sz[Find(v)];
Father[Find(v)]=Find(u);
return 1;
}
else
{
how[Find(u)][Find(v)]++;
how[Find(v)][Find(u)]++;
}
return 0;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |