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>
#define ll long long
#define ld long double
#define f first
#define s second
#define mp make_pair
#define pb push_back
#define vll vector<ll>
#define pll pair<ll,ll>
using namespace std;
const ll N = 2e6+5;
const ll MOD = 1e9+7;
ll sz[1505];
ll par[1505];
ll cc;
bool fl = false;
ll a=-1,b=-1;
void make_set(ll nd){
sz[nd] = 0;
par[nd] = nd;
}
ll findpar(ll nd){
if(par[nd] == nd) return nd;
else return par[nd] = findpar(par[nd]);
}
void merge(ll u,ll v){
u = findpar(u),v = findpar(v);
if(u == v) return ;
if(sz[u] > sz[v]) swap(u,v);
sz[v] += sz[u];
par[u] = v;
cc--;
}
void initialize(int n){
for(int i = 1;i<=n;i++) make_set(i);
cc =n;
}
int hasEdge(int u, int v){
if(u < v) swap(u,v);
return (++sz[u] == u);
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |