# | 제출 시각UTC-0 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
973448 | cot7302 | Joker (BOI20_joker) | C++17 | 343 ms | 16560 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
struct disjoint_set {
int n, odd_cir;
vector<int> _, odd_cir_op;
vector<tuple<int, int, int>> op;
disjoint_set(int n) : n(n), odd_cir(0), _(2 * n + 1, -1), odd_cir_op(), op() {}
int root(int x) { while (_[x] > 0) x = _[x]; return x; }
void __join(int a, int b) {
a = root(a), b = root(b);
if (a == b) return;
if (_[a] > _[b]) swap(a, b);
op.emplace_back(a, b, _[b]);
_[a] += _[b];
_[b] = a;
}
void join(int a, int b) {
__join(a, b + n);
__join(a + n, b);
odd_cir += odd_cir_op.emplace_back(root(a) == root(b));
}
void join(pair<int, int> x) {
auto [a, b] = x;
join(a, b);
}
# | 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... |