# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
784840 | jakobrs | Tracks in the Snow (BOI13_tracks) | C++17 | 1871 ms | 1048576 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 <iostream>
#include <set>
#include <vector>
using i32 = int32_t;
struct UnionFind {
std::vector<i32> parent;
explicit UnionFind(size_t sz) : parent(sz, -1) {}
i32 find(i32 u) {
if (parent[u] < 0)
return u;
else
return parent[u] = find(parent[u]);
}
bool unite(i32 u, i32 v) {
u = find(u);
v = find(v);
if (u == v) {
return false;
} else {
if (-parent[u] < -parent[v])
std::swap(u, v);
parent[u] += parent[v];
parent[v] = u;
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |