# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
981855 | vjudge1 | Swapping Cities (APIO20_swap) | C++17 | 2082 ms | 35528 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 "swap.h"
#include <bits/stdc++.h>
#include <vector>
using namespace std;
long long n, m, i, j, sz[200001], p[200001], d[200001], mx[200001], szm[200001];
vector<pair<long long, long long>> g[200001];
vector<pair<long long, pair<long long, long long>>> gg;
long long get(long long x) {
return x == p[x] ? x : p[x] = get(p[x]);
}
void merge(long long xx, long long yy) {
long long x = get(xx), y = get(yy);
mx[x] = max({mx[x], d[x], d[xx]});
mx[y] = max({mx[y], d[y], d[yy]});
mx[x] = max(mx[x], mx[y]);
mx[y] = max(mx[y], mx[x]);
szm[x]++;
if (x == y) return;
if (sz[x] < sz[y]) swap(x, y);
p[y] = x;
sz[x] += sz[y];
szm[x] += szm[y];
mx[x] = max(mx[x], mx[y]);
}
void init(int N, int M,
std::vector<int> U, std::vector<int> V, std::vector<int> W) {
n = N, m = M;
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... |