# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
604969 | Hazem | ICC (CEOI16_icc) | C++14 | 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 "icc.h"
using namespace std;
const int N = 2e5+10;
int a[N],par[N];
int find_par(int x){
if(x==par[x])
return x;
return par[x] = find_par(par[x]);
}
void run(int n){
for(int i=1;i<=n;i++)
par[i] = i;
int T = n-1;
while(T--){
for(int i=1;i<=n;i++)
for(int j=i+1;j<=n;j++)
if(find_par(i)!=find_par(j)){
int v = query(1,1,{i},{j});
if(v){
setRoad(i,j);
par[j] = i;
break;
}
}
}
}