![](https://img-blog.csdnimg.cn/20201014180756780.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
图论--最近公共祖先
fire__ice
这个作者很懒,什么都没留下…
展开
-
poj 1470 Closest Common Ancestors(LCA)
题目链接:http://poj.org/problem?id=1470 题意:LCA 方法:Tarjin 或 RMQ 裸题,不解释,就是输入有点麻烦。。。 #include #include #include #include using namespace std; #define clr(arr,v) memset(arr,v,sizeof(arr)) const int原创 2012-10-06 16:50:42 · 355 阅读 · 0 评论 -
poj 1330 Nearest Common Ancestors(LCA)
题目链接:http://poj.org/problem?id=1330 题意:给出一颗树,最后寻问两个点的最近公共祖先。 可以用LCA来解决,没什么问题。 #include #include #include #include using namespace std; #define clr(a,b) memset(a,b,sizeof(a)) const int M = 10005;原创 2012-10-24 10:06:35 · 101 阅读 · 0 评论