# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
806299 | NekoRolly | Monthly railway pass (LMIO18_menesinis_bilietas) | C++17 | 174 ms | 37460 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 N = 5e5+4;
struct Dsu
{
int rt[N],h[N],sz[N];
void build(int n){
for (int i=1; i<=n; i++){
h[i] = 1, sz[i] = 1;
rt[i] = i;
}
}
int find(int a){
if (a == rt[a]) return a;
return rt[a] = find(rt[a]);
}
void join(int a,int b){
a = find(a), b = find(b);
if (a == b) return;
if (h[a] > h[b]){
swap(a, b);
}
h[b] += (h[a] == h[b]);
sz[b] += sz[a];
rt[a] = b;
}
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... |