题目 题解 #include<bits/stdc++.h> using namespace std; const int N=100002; #define up(t) tr[t]=(tr[t<<1]+tr[t<<1|1])%M; #define mid ((l+r)>>1) struct node{ int to,ne; }e[N<<1]; int son[N],top[N],tr[N<<2],w[N],wt[N],id[N],la[N<<2],tot,h[N],fa[N],x,y,z,M,r,dep[N]...