# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
823906 | tch1cherin | Joker (BOI20_joker) | C++17 | 561 ms | 50548 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;
struct dsu {
int size;
int _bipartite;
vector<vector<pair<int*, int>>> updates;
vector<int> parent, rank;
dsu(int _size) : size(_size), _bipartite(1), parent(2 * _size, -1), rank(2 * _size, 1) {}
int _get(int u) {
return parent[u] == -1 ? u : _get(parent[u]);
}
void _unite(int u, int v) {
u = _get(u), v = _get(v);
if (u != v) {
if (rank[u] < rank[v]) {
swap(u, v);
}
updates.back().push_back(pair {&parent[v], parent[v]});
updates.back().push_back(pair {&rank[u], rank[u]});
parent[v] = u;
rank[u] += rank[v];
}
}
void unite(int u, int v) {
updates.push_back({});
# | 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... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |