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;
typedef long long ll;
ll p[1505],sz[1505];
ll lider(ll a) {
if (p[a]==a) return a;
p[a] = lider(p[a]);
return p[a];
}
void unir(ll a, ll b) {
if (sz[b]>sz[a]) swap(a,b);
p[b] = a;
sz[a] += sz[b];
return;
}
void initialize(int n) {
ll i;
for (i=0;i<n;i++) {
p[i] = i;
sz[i] = 1;
}
return;
}
int hasEdge(int u, int v) {
if (lider(u)==lider(v)) return 0;
else {
unir(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... |