
树-LCA
LucienShui
因为孤独是人之常态,所以陪伴才显得格外可贵。
展开
-
Nearest Common Ancestors - POJ 1330 - LCA
链接: http://poj.org/problem?id=1330题目:DescriptionA rooted tree is a well-known data structure in computer science and engineering. An example is shown below: In the figure, each node is labeled with an原创 2017-08-06 14:29:24 · 245 阅读 · 0 评论 -
[模板] - LCA倍增
成员:const int maxn = 1007; int up[maxn][32];//倍增数组 int depth[maxn];//每个点在树中的深度 int n,m;//n个点,m条边 bool vis[maxn]; vector<int> tree[maxn];//邻接表函数:DFS记录深度和初始化倍增数组://记录各节点i的深度depth[i],dfs一遍即可O(N) void dfs(i原创 2017-08-06 14:18:49 · 355 阅读 · 1 评论 -
How far away? - HDU 2586 - LCA
链接: http://acm.hdu.edu.cn/showproblem.php?pid=2586题目:Problem Description There are n houses in the village and some bidirectional roads connecting them. Every day peole always like to ask like this “原创 2017-08-06 14:41:28 · 279 阅读 · 0 评论 -
UPC-5909 - 货物运输 - 倍增LCA
题解链接: https://lucien.ink/archives/122/ 题目链接: http://exam.upc.edu.cn/problem.php?id=5909 题目: 题目描述 在一片苍茫的大海上,有n座岛屿,岛屿与岛屿之间由桥梁连接,所有的岛屿刚好被桥梁连接成一个树形结构,即共n-1架桥梁,且从任何一座岛屿出发都能到达其他任何一座岛屿。 第i座桥梁有一个...原创 2018-03-20 15:41:45 · 284 阅读 · 0 评论 -
ACM-ICPC 2018 徐州赛区网络预赛-J - Maze Designer - 最大生成树
题解链接 https://www.lucien.ink/archives/344/ 题目链接 https://nanti.jisuanke.com/t/31462 题目 After the long vacation, the maze designer master has to do his job. A tour company gives him a map wh...原创 2018-09-10 02:05:26 · 582 阅读 · 0 评论