![](https://img-blog.csdnimg.cn/20190927151132530.png?x-oss-process=image/resize,m_fixed,h_224,w_224)
LCA
LCA
浪漫些许潦草
这个作者很懒,什么都没留下…
展开
-
hdu 2586 How far away ?(在线LCA+离线Tarjan)
How far away ?题目链接:How far away ?题意:一个村子里有n个房子,这n个房子用n-1条路连接起来,接下了有m次询问,每次询问两个房子a,b之间的最短距离是多少。思路:LCA模板题代码(离线Tarjan):#include<stdio.h>#include<string.h>#include<vector>#include<algorithm>using names原创 2017-08-08 09:06:33 · 476 阅读 · 0 评论 -
hdu 6115 Factory(LCA+暴力)
Factory题目链接:Factory思路:在线LCA算法+暴力枚举枚举两个子公司的所有点对代码:#include<stdio.h>#include<math.h>#include<set>#include<string.h>#include<algorithm>using namespace std;const int inf=0x3f3f3f3f;const int maxn=1e5原创 2017-08-18 17:23:23 · 472 阅读 · 0 评论