#include<iostream>
#include<cstdio>
using namespace std;
struct edge{
int to,next,v;
}e[2100001];
long long ans;
int n,cnt,size[1100001],head[1100001],fa[1100001];
inline int read(){
int x=0,f=1;char ch=getchar();
while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
return x*f;
}
inline int iabs(int x){return x<0?-x:x;}
void ins(int u,int v,int w){
e[......
阅读全文