# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
367086 | Jarif_Rahman | Bridges (APIO19_bridges) | C++17 | 100 ms | 15004 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>
#define pb push_back
#define f first
#define sc second
using namespace std;
typedef long long int ll;
typedef string str;
struct dsu{
int n;
vector<int> id;
vector<vector<int>> comp;
dsu(int nn){
n = nn;
for(int i = 0; i < n; i++) id.pb(i), comp.pb({i});
}
void unite(int a, int b){
a = id[a], b = id[b];
if(a == b) return;
if(comp[a].size() > comp[b].size()) swap(a, b);
while(!comp[a].empty()){
int x = comp[a].back(); comp[a].pop_back();
id[x] = b;
comp[b].pb(x);
}
}
};
int main(){
ios_base::sync_with_stdio(0);
cin.tie(0);
int n, m; cin >> n >> m;
# | 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... |