# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
132213 | MoNsTeR_CuBe | Simurgh (IOI17_simurgh) | C++17 | 0 ms | 0 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>
#include "simurgh.h"
using namespace std;
vector< int > U;
int getParents(int a){
if(U[a] == a) return a;
else return U[a] = getParents(U[a]);
}
void Union(int a, int b){
U[getParents(a)] = getParents(b);
}
int makeBetter(vector< tuple<int, int, int> > &golden, vector< tuple<int, int, int> > &rem, int start, int n){
for(int i = 0; i < n-1; i++){
for(int j = 0; j < n;j++){
U[j] = j;
}
vector< tuple<int, int, int> > tempo;
vector< int > ans;
for(int j = 0; j < n-1; j++){
if(j == i) continue;
assert(getParents(get<0>(golden[j])) != getParents(get<1>(golden[j])));
Union(get<0>(golden[j]), get<1>(golden[j]));