# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1135270 | alir3za_zar3 | Village (BOI20_village) | C++20 | 1096 ms | 82704 KiB |
// Alir3za.Zar3 -> Shiraz , Iran
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define loop(i , l , r) for (int i=l; i<=r; i+=1)
#define arc(i , r , l) for (int i=r; i>=l; i-=1)
const int N = 1e5+7;
int n,Lo,Hi=0 , lo[N],hi[N],sz[N],so[N],k[N];
deque<pair<int,int>> q[N];
vector<int> e[N];
int root (int v)
{ return k[v]==v ? v:k[v]=root(k[v]); }
void Union (int u , int v , int d)
{
v=root(v); u=root(u);
if (so[v]<so[u]){ swap(v,u); }
k[u]=v;
deque<pair<int,int>> update;
vector<pair<int,int>> op;
loop(i,0,so[u]-1)
{
op.push_back({q[u].front().first,d});
op.push_back({q[v].front().first,d});
swap(hi[q[u].front().first],
hi[q[v].front().first]);
q[u].pop_front();
q[v].pop_front();
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |