网站首页
编程语言
数据库
系统相关
其他分享
编程问答
P2491
2024-09-16
D49 树的直径 P2491 [SDOI2011] 消防
视频链接: P2491[SDOI2011]消防-洛谷|计算机科学教育新生态(luogu.com.cn)//两次DFS+双指针O(n)#include<iostream>#include<cstring>#include<algorithm>usingnamespacestd;constintN=300010;intidx,head[N];structedge{intto,w,ne;}e[N<<1]