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 <bits/stdc++.h>
using namespace std;
const int N = 2000;
int n1;
int cnt;
int r = 0;
int a[N];
int p[N];
int get( int x )
{
return (p[x] == x ? x : p[x] = get(p[x]));
}
void initialize(int n)
{
n1 = n;
cnt = n;
for( int i = 1; i <= n; i++ )p[i] = i;
}
int hasEdge(int u, int v)
{
u += 1 , v += 1;
r += 1;
if( r == n1 * (n1 - 1) / 2 )return 1;
int x = get(u);
int y = get(v);
if( x == y )return 1;
if( cnt == 2 )return 0;
cnt -= 1;
return 1;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |