# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
118370 | teomrn | One-Way Streets (CEOI17_oneway) | C++14 | 283 ms | 28792 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 NMAX = 100010;
const int LGMAX = 20;
namespace UF {
int tata[NMAX], g[NMAX];
int find(int x) {
if (tata[tata[x]] != tata[x])
tata[x] = find(tata[x]);
return tata[x];
}
bool unite(int a, int b) {
a = find(a);
b = find(b);
if (a == b)
return 0;
if (g[a] < g[b])
swap(a, b);
tata[b] = a, g[a] += g[b];
return 1;
}
void UF(int n) {
fill(g, g + n + 1, 1);
iota(tata, tata + n + 1, 0);
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |