# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
419147 | pauloamed | Bridges (APIO19_bridges) | C++14 | 3055 ms | 5792 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 MAXN 100010
#define BLOCK 600
int sizes[MAXN]; // vetor com tamanhos
int parents[MAXN]; // vetor com pai de cada no
struct DSU{
int numComponents;
stack<pair<int,int>> lastPar, lastSize;
vector<int> checkpoints;
DSU(int n){
lastPar = lastSize = stack<pair<int,int>>();
checkpoints = {0};
numComponents = n;
for(int i = 1; i <= n; ++i){
sizes[i] = 1; // tamanho inicial
parents[i] = i; // valor padrao: cada um eh seu pai
}
}
int find(int current){
int newRoot = current; // variavel para guardar nova raiz
while(newRoot != parents[newRoot]) // enquanto nao encontro no raiz
newRoot = parents[newRoot]; // subo na arvore
return newRoot; // retornamo a raiz da arvore
}
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... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |