# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
253560 | erray | Izlet (COI19_izlet) | C++14 | 1382 ms | 61432 KiB |
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;
class dsu {
public:
vector<int> par, ct;
dsu(int sz) {
ct.resize(sz, 1);
par.resize(sz);
iota(par.begin(), par.end(), 0);
}
int get_par(int nd) {
return (par[nd] == nd ? nd : get_par(par[nd]));
}
bool Merge(int a, int b) {
a = get_par(a), b = get_par(b);
if (a == b) return false;
if (ct[a] < ct[b]) swap(a, b);
ct[a] += ct[b];
par[b] = a;
return true;
}
};
int main () {
ios_base::sync_with_stdio(0);
cin.tie(0);
int type, n;
cin >> type >> n;
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |