直接上代碼
#include#include #include #include using namespace std; const int INF=0x3f3f3f3f; const int Max=110000; int fa[Max]; int find(int x) { if(fa[x]==x) return x; else return fa[x]=find(fa[x]); } struct Side { int r; int l; int w; bool operator <(const Side &ano)const { return w