# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
966727 | penguin133 | 자매 도시 (APIO20_swap) | C++17 | 257 ms | 39760 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;
#include "swap.h"
//#define int long long
#define pi pair<int, int>
#define pii pair<int, pi>
#define fi first
#define se second
#ifdef _WIN32
#define getchar_unlocked _getchar_nolock
#endif
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
vector <int> waiting[200005];
int par[200005], val[200005], deg[200005], good[200005], up[20][200005], dep[200005];
int cnt = 1;
pi adj[200005];
int getr(int x){return par[x] == x ? x : par[x] = getr(par[x]);}
void merge(int a, int b, int c){
a = getr(a); b = getr(b);
if(a == b)return;
par[a] = par[b] = up[0][a] = up[0][b] = par[cnt];
if((int)waiting[a].size() < (int)waiting[b].size())swap(a, b);
swap(waiting[cnt], waiting[a]);
for(auto j : waiting[b])waiting[cnt].push_back(j);
val[cnt] = c;
adj[cnt] = {a, b};
good[cnt] = 1;
cnt++;
}
# | 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... |