# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1165297 | Kerim | Toll (APIO13_toll) | C++20 | 875 ms | 11264 KiB |
#include "bits/stdc++.h"
#define ll long long
#define ff first
#define ss second
#define edgew tuple<int, int, int>
#define edge pair<int,int>
using namespace std;
struct connectivity{
vector<int> ata;
vector<int> sz;
int n;
connectivity(int _n){
n = _n;
ata.resize(n+1);
sz.resize(n+1);
}
void init(){
for (int i = 1; i <= n; i++)
ata[i] = i, sz[i] = 1;
}
int tap(int x){
if (ata[x] == x)
return x;
return ata[x] = tap(ata[x]);
}
bool merge(int x, int y){
if ((x=tap(x)) == (y=tap(y)))
return 0;
if (sz[x] < sz[y])
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... |