# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
385512 | LucaDantas | timeismoney (balkan11_timeismoney) | C++17 | 553 ms | 748 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;
#define pb push_back
constexpr int maxn = 210, maxm = 1e4+10;
int n, m;
struct DSU
{
int pai[maxn], peso[maxn];
bool get_ans = 0;
void init() { for(int i = 0; i <= n; i++) pai[i] = i, peso[i] = 1; }
int find(int x) { return pai[x]==x?x:pai[x]=find(pai[x]); }
bool join(int a, int b) {
int x = a, y = b;
a = find(a), b = find(b);
if(a == b) return 0;
if(peso[a] < peso[b])
swap(a, b);
pai[b] = a;
peso[a] += peso[b];
if(get_ans) printf("%d %d\n", x, y);
return 1;
}
} dsu;
struct Edge
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |