# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
765482 | Hegdahl | Joker (BOI20_joker) | C++17 | 2045 ms | 8396 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 UnionFind {
vector<int> parent_or_neg_size, edge_parity;
struct UndoInfo {
int i, j, j_sz;
};
vector<UndoInfo> undo_info;
UnionFind(int n) : parent_or_neg_size(n, -1),
edge_parity(n, 0) {}
pair<int, int> find_root_and_parity(int i) {
int parity = 0;
while (parent_or_neg_size[i] >= 0) {
parity ^= edge_parity[i];
i = parent_or_neg_size[i];
}
return {i, parity};
}
enum UniteResult { NO_CYCLE, EVEN_CYCLE, ODD_CYCLE };
UniteResult unite(int i, int j, bool new_edge_parity = true, bool save_undo_info = false) {
auto [root_i, parity_i] = find_root_and_parity(i);
auto [root_j, parity_j] = find_root_and_parity(j);
if (root_i == root_j) {
if (save_undo_info) {
undo_info.push_back({0, 0, 0});
# | 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... |