数据结构——LCA
文章平均质量分 86
sdau_blue
念念不忘,必有回响。驰而不息,功不唐捐。
展开
-
#1067 : 最近公共祖先·二
一道LCA的模板题。代码:#include <cstdio> #include <algorithm> #include<map> #include<string.h> #include<iostream> #define MAXN 1000010 #define MAXM 1000010 using namespace std; map...原创 2018-03-21 21:32:11 · 189 阅读 · 0 评论 -
Connections between cities(LCA+并查集)
题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=2874 Connections between cities Time Limit: 10000/5000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 15139 Ac...原创 2018-08-14 15:53:15 · 397 阅读 · 1 评论 -
How far away ?(LCA)模板
How far away ? http://acm.hdu.edu.cn/showproblem.php?pid=2586 Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 23138 Accepted Submission(s)...原创 2018-08-14 16:34:24 · 292 阅读 · 0 评论 -
Traffic Network in Numazu(LCA+树状数组)
这么激动的时刻当然要写一篇博客。 这道题在我找寻了重重bug以后终于AC了。 但是难以费解的是,我的样例都没有过就AC了。。。没错。各位大佬们如果看出哪里有问题还请指出,菜鸡实在不明白啊。 http://acm.hdu.edu.cn/showproblem.php?pid=6393 Problem Description Chika is elected mayor of Numazu....原创 2018-08-16 00:16:02 · 242 阅读 · 0 评论 -
Maze Designer(最大生成树+LCA)
After the long vacation, the maze designer master has to do his job. A tour company gives him a map which is a rectangle. The map consists of N×MN \times MN×M little squares. That is to say, the heigh...原创 2018-09-12 19:47:50 · 362 阅读 · 0 评论 -
最短路(lca+bfs(dij))
链接:https://ac.nowcoder.com/acm/challenge/terminal 来源:牛客网 题目描述 给一个连通图,每次询问两点间最短路。每条边的长度都是1。 输入描述: 第一行两个整数n和m,表示图的点数和边数(1≤ n≤ 100000, 1≤ m≤ n+100)。 接下来m行每行两个整数a和b,表示一条边(1≤ a, b≤ n)。保证没有自环和重边。保证图连...原创 2019-02-01 20:01:29 · 627 阅读 · 0 评论