# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1175750 | Muhammet | Swapping Cities (APIO20_swap) | C++17 | 248 ms | 43644 KiB |
#include "bits/stdc++.h"
#include "swap.h"
// #include "grader.cpp"
using namespace std;
const int N = 3e5 + 5;
int p[N], a[N], c[N], h[N], par[N], sp[N][30];
vector <int> v[N];
int fnd(int x) {
if(p[x] == x) return x;
return p[x] = fnd(p[x]);
}
void dfs(int x, int y) {
h[x] = h[y] + 1;
par[x] = y;
for(auto i : v[x]) {
dfs(i, x);
}
}
int lca(int x, int y) {
if(h[x] < h[y]) swap(x, y);
for(int i = 29; i >= 0; i--) {
if(h[sp[x][i]] >= h[y]) x = sp[x][i];
}
# | 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... |