0号结点:农夫John山泉天然矿泉水(
by
#include#include #include using namespace std;int n,cnt,tot,ans,fa[100005];struct edge{ int u,v,w;}e[100005];inline void add(int u,int v,int w){ e[++cnt].v=v; e[cnt].u=u; e[cnt].w=w;}inline int getfa(int v){ if(fa[v]==v)return v; fa[v]=getfa(fa[v]); return fa[v];}inline bool cmp(edge x,edge y){ return x.w