
图论 -------- 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 · 371 阅读 · 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 · 397 阅读 · 0 评论