# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1127191 | HossamHero7 | Bridges (APIO19_bridges) | C++20 | 3093 ms | 107744 KiB |
// In sha2 Allah IOI 2025
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define endl '\n'
struct DSU{
vector<int> par;
vector<int> sz;
vector<pair<int,int>> rsz;
vector<int> rpar;
DSU(int n){
par.resize(n+1) , sz.resize(n+1,1);
iota(par.begin(),par.end(),0);
}
int getP(int node){
if(node == par[node]) return node;
return getP(par[node]);
}
bool join(int a,int b){
a = getP(a) , b = getP(b);
if(a == b) return 0;
if(sz[a] < sz[b]) swap(a,b);
rsz.push_back({a,sz[a]});
rpar.push_back(b);
par[b] = a;
sz[a] += sz[b];
return 1;
}
void rollback(){
sz[rsz.back().first] = rsz.back().second;
# | 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... |