#include<cstdio> #include<algorithm> #define N 50010 #define M 500010 #define rg register #define LL long long using namespace std; int n,m,cnt,root,tot,totnow,totbf; int last[N],size[N],mxsize[N],dep[N],tmp[N],mg[N]; LL ans=; bool v[N]; struc…
Description Give a tree with n vertices,each edge has a length(positive integer less than 1001). Define dist(u,v)=The min distance between node u and v. Give an integer k,for every pair (u,v) of vertices is called valid if and only if dist(u,v) not e…