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;
int n, edge, edge_not;
int pa[1505], deg_not[1505];
int fp(int u)
{
return (u == pa[u]) ? u : pa[u] = fp(pa[u]);
}
void initialize(int N)
{
n = N;
for(int i=0 ; i<n ; i++) pa[i] = i;
edge = n-1;
edge_not = (n*(n-1))/2 - edge;
}
int hasEdge(int u, int v)
{
if(edge_not > 0 && deg_not[u]+1 != n-1 && deg_not[v]+1 != n-1)
{
edge_not--;
deg_not[u]++;
deg_not[v]++;
return 0;
}
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... |