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<bits/stdc++.h>
using namespace std;
int par[1505], ccnt;
int find(int x) { if(x==par[x])return x;else return par[x]=find(par[x]); }
void merge(int a, int b) { a = find(a), b = find(b); if(a==b)return; par[a]=b; ccnt--;}
void initialize(int n){ for(int i = 1; i <= n; i++) par[i] = i; ccnt = n; }
int hasEdge(int u, int v) {if(ccnt==2)return 0;else {merge(u,v); 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... |