![](https://img-blog.csdnimg.cn/20201014180756930.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
并查集
箱@子
这个作者很懒,什么都没留下…
展开
-
HDU - 6832 F - A Very Easy Graph Problem dfs + 并查集
An undirected connected graph hasnnnodes andmmedges, Theii-th edge’s length is2i2i. Each nodeiihas a valueaiai, which is either00or11. You need to calculate:∑i=1n∑j=1nd(i,j)×[ai=1∧aj=0]∑i=1n∑j=1nd(i,j)×[ai=1∧aj=0]d(i,j)d(i,j)indicates th...原创 2020-08-14 17:11:08 · 152 阅读 · 0 评论 -
2020牛客多校第三场 Operating on a Graph
You are given a graph containing n vertices and m edges. Vertices are numbered from0ton-1. Initially, vertexibelongs to groupi. We define a groupAis connected to groupBif and only if there exists at least an edge that connects the two vertices wh...原创 2020-07-28 13:39:54 · 204 阅读 · 0 评论 -
ZOJ - 3261 I - Connections in Galaxy War
Connections in Galaxy WarZOJ - 3261In order to strengthen the defense ability, many stars in galaxy allied together and built many bidirectional tunnels to exchange messages. However, when the G...原创 2020-03-24 22:19:46 · 106 阅读 · 0 评论 -
POJ - 1308 Is It A Tree?
A tree is a well-known data structure that is either empty (null, void, nothing) or is a set of one or more nodes connected by directed edges between nodes satisfying the following properties.There ...原创 2020-02-01 22:25:29 · 113 阅读 · 0 评论 -
HDU - 3635 Dragon Balls 并查集
Five hundred years later, the number of dragon balls will increase unexpectedly, so it's too difficult for Monkey King(WuKong) to gather all of the dragon balls together.His country has N cities...原创 2019-11-10 15:39:21 · 84 阅读 · 0 评论 -
并查集之种类并查集
种类并查集就是将不同种类的合并在一起(qaq好像是废话)直接看题吧1.P1525 关押罪犯输入 #1复制4 61 4 25342 3 35121 2 283511 3 66182 4 18053 4 12884输出 #1复制3512可以直接用并查集先贪心从大到小排序 然后加一个数组来判断他的敌人 如果他有敌人了将它敌人和敌人合并当他和敌人在...原创 2019-11-08 19:22:51 · 760 阅读 · 1 评论 -
HDU - 3938 Portal 离线并查集
ZLGG found a magic theory that the bigger banana the bigger banana peel .This important theory can help him make a portal in our universal. Unfortunately, making a pair of portals will cost min{T} ene...原创 2019-11-08 08:58:32 · 88 阅读 · 0 评论 -
HDU - 1811 Rank of Tetris
Rank of Tetris自从Lele开发了Rating系统,他的Tetris事业更是如虎添翼,不久他遍把这个游戏推向了全球。为了更好的符合那些爱好者的喜好,Lele又想了一个新点子:他将制作一个全球Tetris高手排行榜,定时更新,名堂要比福布斯富豪榜还响。关于如何排名,这个不用说都知道是根据Rating从高到低来排,如果两个人具有相同的Rating,那就按这几个人的RP从高到低来...原创 2019-11-04 20:32:51 · 144 阅读 · 0 评论 -
HDU1598 find the most comfortable road
find the most comfortable roadHDU - 1598XX星有许多城市,城市之间通过一种奇怪的高速公路SARS(Super Air Roam Structure---超级空中漫游结构)进行交流,每条SARS都对行驶在上面的Flycar限制了固定的Speed,同时XX星人对 Flycar的“舒适度”有特殊要求,即乘坐过程中最高速度与最低速度的差越小乘坐越舒服 ,...原创 2019-11-01 16:41:51 · 125 阅读 · 1 评论