# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
332429 | a14789654 | Roller Coaster Railroad (IOI16_railroad) | C++17 | 0 ms | 0 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 MAXN = 2e5 + 7;
int par[MAXN], n, in[MAXN], out[MAXN], a[MAXN], b[MAXN];
vector <int> V;
int pos(int x)
{
return lower_bound(V.begin(), V.end(), x) - V.begin() + 1;
}
int root(int u)
{
return par[u] < 0 ? u : par[u] = root(par[u]);
}
void join(int u, int v)
{
if ((u = root(u)) == (v = root(v))) return;
if (par[u] > par[v]) swap(u, v);
par[u] += par[v];
par[v] = u;
}
int main()
{
if (fopen("tst.inp", "r"))