![](https://img-blog.csdnimg.cn/20201014180756724.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
图论 -------- LCA
SolarDomo
每天都被头像萌醒
展开
-
HDU 2586 How far away ? Tarjan 离线最近公共祖先
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2586裸的最近公共祖先代码:#include <bits/stdc++.h> #define sf scanf #define pf printfusing namespace std; const int maxn = 40000 + 50,maxnm = 200 + 5; int fa[maxn],v原创 2016-10-11 18:49:41 · 322 阅读 · 0 评论 -
SPOJ Count on a tree 在线LCA + 主席树
题意:求树上a , b路径上第k大的点 主席树a + 主席树b - 主席树(LCA(a,b)) - 主席树(FA(LCA(a,b)))代码:#include <bits/stdc++.h> #define sf scanf #define pf printf using namespace std; const int maxn = 100000 + 50; /** 主席树 */ const in原创 2016-10-13 22:12:50 · 336 阅读 · 0 评论