# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
338464 | KoD | Collapse (JOI18_collapse) | C++17 | 364 ms | 23628 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>
template <class T>
using Vec = std::vector<T>;
struct DSU {
Vec<int> par;
int cmp;
std::stack<std::tuple<int, int, int, int, int>> stack;
DSU(const int n): par(n, -1), cmp(n) { }
int find(int x) const {
while (par[x] >= 0) {
x = par[x];
}
return x;
}
int merge(int x, int y) {
x = find(x);
y = find(y);
if (x == y) {
return 0;
}
if (par[x] > par[y]) {
std::swap(x, y);
}
stack.emplace(x, par[x], y, par[y], cmp);
par[x] += par[y];
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |