# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
562249 | hollwo_pelw | Swapping Cities (APIO20_swap) | C++17 | 187 ms | 39316 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>
using namespace std;
const int N = 1e5 + 5, M = 2e5 + 5;
int n, m, fa[N + M], val[N + M], col[N + M];
int par[19][N + M], nxt[N + M], d[N + M];
vector<int> adj[N + M];
inline int find(int u) { return fa[u] == u ? u : fa[u] = find(fa[u]); }
inline void merge(int u, int v, int w) {
if ((u = find(u)) == (v = find(v))) {
if (!col[u]) {
fa[u] = ++ n;
adj[n].push_back(u);
col[n] = 1, val[n] = w;
}
return ;
}
fa[u] = fa[v] = ++ n;
adj[n].push_back(u);
adj[n].push_back(v);
col[n] = col[u] | col[v], val[n] = w;
}
void pre_dfs(int u, int f = 0) {
if (col[u]) f = u;
nxt[u] = f;
# | 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... |