给定n个结点的树,定义G(k)为n个结点的图,u,v之间有边当且仅当u,v在树上的距离大于等于k。对任意k(1 <= k <= n), 求G(k)连通分量的个数
题目思路:代码优化:在找直径端点的时候把其他结点到直径两端点的距离都求出来,不用lca#includeusingnamespacestd;#defineintlonglong#definepbpush_back#definefifirst#definesesecond#definelsonpG[maxn];intp[maxn];intfa[21][maxn],dep[maxn];intans[ma