#include using std::cin; using std::cout; #define endl "\n" using std::vector; using ll=long long; //宣言、modpow const int mod=1e9+7; vector> edge,weight; vector dp,subtree,sum; vector flag; ll ans=0; ll modpow(ll x,ll y){ ll ret=1; while(y){ if(y&1){ ret*=x; ret%=mod; } x*=x; x%=mod; y/=2; } return ret; } //dfs void dfs(int now){ flag[now]=1; for(int i=0;i par; Union_Find(int n):N(n){ par.resize(N); for(int i=0;i>N; assert(1<=N&&N<=max); Union_Find tree(N); for(int i=1;i>x>>y>>z; assert(1<=x&&x<=N&&1<=y&&y<=N&&1<=z&&z<=inf); assert(tree.root(x-1)!=tree.root(y-1)); } }