摘要: 感觉我的智商可能不够写题解,就直接截了hzwer的blog 地址http://hzwer.com/2656.html cpp include include include using namespace std; const int N=1000005; int n,a[N],c[N],p; lo 阅读全文
posted @ 2018-08-04 14:25 lokiii 阅读(145) 评论(0) 推荐(0) 编辑
摘要: 两遍dfs一遍向下,一边向上,分别记录子树内人数a,当前点到所有点的距离b,最大值c和次大值d,最大值子树p 然后答案是2b c cpp include include using namespace std; const int N=1000005; int n,m,h[N],cnt,p[N]; 阅读全文
posted @ 2018-08-04 10:58 lokiii 阅读(406) 评论(1) 推荐(0) 编辑