摘要: 树的直径指最长的路径,我们一般求此路径的两个端点,性质,中电的子树节点个数小于等于n/2; 一般两边dfs求取 1 struct edge{ 2 int to; 3 int w; 4 int next; 5 }e[N]; 6 int head[N]; 7 ll dis[N]; 8 ll dis2[N 阅读全文