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 <stdio.h>
#define N (1500)
int p[N], e[N][N], nn;
void initialize(int n){
nn=n;
for(int i=0;i<n;i++){
p[i]=i;
for(int j=0;j<n;j++)e[i][j]=i!=j;
}
}
int find(int x){if(p[x] == x)return x;return p[x] = find(p[x]);}
int hasEdge(int u, int v){
int a = find(u), b = find(v);
if(e[a][b]==1){
p[b]=a;
for(int i=0; i<nn; i++)e[a][i]=e[i][a]+=e[b][i];
return 1;
}
e[a][b]=--e[b][a];
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... |