摘要: LCA最近公共祖先 学习链接 [https://blog.csdn.net/creatorx/article/details/70739834] hdu 2586 [http://acm.hdu.edu.cn/showproblem.php?pid=2586] 题意 给出每两个相邻节点的距离 询问任 阅读全文
posted @ 2019-08-03 21:00 ChunhaoMo 阅读(109) 评论(0) 推荐(0)
摘要: ``` 直径 include include include include include include using namespace std; const int N=4e4+10; int d[N],head[N],ver[N],next[N],edg[N]; bool vis[N]; i 阅读全文
posted @ 2019-08-03 21:00 ChunhaoMo 阅读(144) 评论(0) 推荐(0)
摘要: ``` include using namespace std; typedef long long ll; const int N = 1e7+5; int p[N],oa[N]; bool vis[N]; int oula(int n) { memset(vis,0,sizeof(vis)); 阅读全文
posted @ 2019-08-03 20:51 ChunhaoMo 阅读(343) 评论(0) 推荐(0)