![](https://img-blog.csdnimg.cn/20201014180756930.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
并查集
Than-
这个作者很懒,什么都没留下…
展开
-
CodeForces - 731C Socks(贪心+并查集+STL)
Arseniy is already grown-up and independent. His mother decided to leave him alone for m days and left on a vacation. She have prepared a lot of food, left some money and washed all Arseniy’s clothes....原创 2020-01-10 17:07:56 · 559 阅读 · 0 评论 -
Cube Stacking
原题链接: http://poj.org/problem?id=1988 题意: 给定N个方块,排成一行,将它们编号1到N。再给出P个操作: ①M i j表示将i所在的那一堆移到j所在那一堆的顶上。 ②C i表示一个询问,询问i下面有多少个方块。 思路: 带权并查集,一堆中最顶上的方块作为父节点,用dis[X] 统计X到父亲节点的距离,num[fa[X]]表示这个集合的大小,两者相减即为答案。 标...原创 2020-01-09 19:17:50 · 95 阅读 · 0 评论 -
POJ-2492 A Bug's Life(二分图染色 或者 种类并查集)
A Bug’s Life Description Background Professor Hopper is researching the sexual behavior of a rare species of bugs. He assumes that they feature two different genders and that they only interact with b...原创 2019-12-10 20:03:13 · 127 阅读 · 0 评论 -
POJ - 1456 Supermarket(贪心+并查集优化)
Supermarket Description A supermarket has a set Prod of products on sale. It earns a profit px for each product x∈Prod sold by a deadline dx that is measured as an integral number of time units starti...原创 2019-12-07 10:40:34 · 169 阅读 · 0 评论 -
HDU - 3038 How Many Answers Are Wrong(带权并查集+路径压缩)
How Many Answers Are Wrong Problem Description TT and FF are … friends. Uh… very very good friends -________-b FF is a bad boy, he is always wooing TT to play the following game with him. This is a ve...原创 2019-12-07 09:51:04 · 147 阅读 · 0 评论 -
POJ - 1611 The Suspects(并查集)
The Suspects Description Severe acute respiratory syndrome (SARS), an atypical pneumonia of unknown aetiology, was recognized as a global threat in mid-March 2003. To minimize transmission to others, ...原创 2019-12-06 19:59:56 · 60 阅读 · 0 评论 -
POJ- 2236 Wireless Network(并查集入门)
Wireless Network Description An earthquake takes place in Southeast Asia. The ACM (Asia Cooperated Medical team) have set up a wireless network with the lap computers, but an unexpected aftershock att...原创 2019-12-06 19:29:11 · 83 阅读 · 0 评论