![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
lca
Excelsior_kereo
这个作者很懒,什么都没留下…
展开
-
PKU Campus 2011 B A Problem about Tree lca倍增
题意:n个节点的一棵树,m次询问:求以x为根y的父亲节点。 思路:lca倍增算法。利用bfs求出每个节点的深度以及2^i倍祖先。接下来求x和y的lca,如果lca!=y,那么y的父节点就是ancestor[y][0],不然求x的depth[x]-depth[y]-1祖先结点。画图还是比较看粗来的,详见程序: #include #include #include #include #includ原创 2014-05-15 23:12:43 · 740 阅读 · 0 评论 -
poj3417 Network 离线LCA + 树形dp
Language: Default Network Time Limit: 2000MS Memory Limit: 65536K Total Submissions: 3827 Accepted: 1095 Description Yixght is a manager of the company called Szq原创 2014-07-04 23:25:04 · 773 阅读 · 0 评论 -
poj1330 Nearest Common Ancestors LCA倍增法 或 LCA转RMQ
Language: Default Nearest Common Ancestors Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 17123 Accepted: 9115 Description A rooted tree is a well-kno原创 2014-06-28 15:15:50 · 844 阅读 · 0 评论 -
poj1470 Closest Common Ancestors 离线LCA
Language: Default Closest Common Ancestors Time Limit: 2000MS Memory Limit: 10000K Total Submissions: 14915 Accepted: 4745 Description Write a program that takes原创 2014-06-29 11:17:36 · 910 阅读 · 0 评论 -
poj3728 The merchant LCA+RMQ或 LCA+b并查集 好题!
Language: Default The merchant Time Limit: 3000MS Memory Limit: 65536K Total Submissions: 3020 Accepted: 999 Description There are N cities in a country, and ther原创 2014-07-01 14:23:19 · 597 阅读 · 0 评论 -
poj1986 Distance Queries 离线LCA
Language: Default Distance Queries Time Limit: 2000MS Memory Limit: 30000K Total Submissions: 8740 Accepted: 3065 Case Time Limit: 1000MS Description Farmer原创 2014-07-01 22:59:55 · 711 阅读 · 0 评论 -
poj3694 Network 无向图tarjan求桥+LCA
Language: Default Network Time Limit: 5000MS Memory Limit: 65536K Total Submissions: 6617 Accepted: 2341 Description A network administrator manages a large netwo原创 2014-07-06 23:51:47 · 844 阅读 · 0 评论