
并查集 优先队列
萧瑟1
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
连通分量 Aizu - ALDS1_11_D Connected Components dfs或bfs或并查集
Write a program which reads relations in a SNS (Social Network Service), and judges that given pairs of users are reachable each other through the network. Input In the first line, two integer nn an...原创 2018-08-31 18:30:47 · 382 阅读 · 0 评论 -
PAT (Advanced Level) Practice 1021 Deepest Root (25 分)
A graph which is connected and acyclic can be considered a tree. The hight of the tree depends on the selected root. Now you are supposed to find the root that results in a highest tree. Such a root i...原创 2018-09-22 20:32:24 · 185 阅读 · 0 评论 -
PTA 中国大学MOOC-陈越、何钦铭-数据结构-2018秋 05-树8 File Transfer (25 分) 并查集
We have a network of computers and a list of bi-directional connections. Each of these connections allows a file transfer from one computer to another. Is it possible to send a file from any computer ...原创 2018-10-06 19:21:38 · 427 阅读 · 0 评论 -
牛客练习赛41 C 抓捕盗窃犯
题目链接: 传送门 思路: 求连通块,因为一个连通块上的顶点在经过无数次传递之后肯定能经过同一个点,所以就求出连通块的数目,然后计算,然后累加前m大的即可。 代码如下: #include <cstdio> #include <cstring> #include <algorithm> #include <iostream> using...原创 2019-03-02 08:07:28 · 207 阅读 · 0 评论