#include<bits/stdc++.h> using namespace std; int const INF=0x3f3f3f3f; int const N=1e4+7; int n,cnt; int f[N],num[N],h[N],sr[N]; set<int>s; struct L{ int p,num; double h,s; }w[N]; int find(int x){ return f[x]==x?x:f[x]=find(f[x]); } void merge(int a,int b){ int fx=find(a),fy=find(b); if(...