# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
261767 | shenxy | Colors (RMI18_colors) | C++11 | 609 ms | 85144 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 <cstdio>
#include <algorithm>
#include <vector>
using namespace std;
typedef pair<int, int> ii;
int N;
vector<int> queries[150000];
bool sad = 0;
struct UFDS {
vector<int> parent, sz;
vector<ii> ops;
UFDS(int N) {
for (int i = 0; i < N; ++i) parent.push_back(i), sz.push_back(1);
}
int find_parent(int i) {
if (parent[i] == i) return i;
return find_parent(parent[i]);
}
void union_set(int p, int q) {
p = find_parent(p), q = find_parent(q);
if (p == q) {
ops.push_back(ii(-1, -1));
return;
}
if (sz[p] < sz[q]) swap(p, q);
parent[q] = p, sz[p] += sz[q];
ops.push_back(ii(p, q));
}
void rollback() {
if (ops.back() == ii(-1, -1)) 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... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |