# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1050730 | duckindog | Joker (BOI20_joker) | C++17 | 239 ms | 12476 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;
const int N = 200'000 + 10;
int n, m, q;
struct Edge {
int u, v;
friend istream& operator >> (istream& is, auto& rhs) {
return is >> rhs.u >> rhs.v;
}
} edge[N];
struct DSU {
int id[N], co[N], cnt;
vector<tuple<int, int, int, int, int, int>> undo;
bool mk[N];
int root(int u) { return id[u] < 0 ? u : root(id[u]); }
bool chk(int u) { return id[u] < 0 ? mk[u] : mk[u] ^ chk(id[u]); }
inline int color(int u) { return co[u] ^ chk(u); }
inline void add(int u, int v) {
int oU = u, oV = v;
u = root(u); v = root(v);
if (u == v) {
undo.emplace_back(0, 0, 0, 0, 0, cnt);
cnt += color(oU) == color(oV);
return;
}
Compilation message (stderr)
# | 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... |