并查集
日月火山
这个作者很懒,什么都没留下…
展开
-
Almost Union-Find(可删除元素的并查集)
【题目大意】 初始给定n个集合:{1},{2},…,{n},要求支持三种操作: 1 "1 p q":若p,q不在同一集合,将它们所在的集合合并成一个。 2 "2 p q":若p,q不在同一集合,将元素p移动到q所在的集合。 3 "3 p" :询问p所在集合的元素个数及元素和。 总共原创 2017-07-21 11:06:45 · 394 阅读 · 0 评论 -
G - Bear and Friendship Condition (并查集)
Bear Limak examines a social network. Its main functionality is that two members can become friends (then they can talk with each other and share funny pictures). There are n members, numbered 1 thro原创 2017-07-18 19:30:05 · 419 阅读 · 0 评论 -
zoj 1586 QS Network(最小生成树)
Sunny Cup 2003 - Preliminary Round April 20th, 12:00 - 17:00 Problem E: QS Network In the planet w-503 of galaxy cgb, there is a kind of intelligent creature named QS. QScommunicate with each oth原创 2017-07-31 16:14:17 · 293 阅读 · 0 评论 -
PKU1251 Jungle Roads (最小生成树+输入)
The Head Elder of the tropical island of Lagrishan has a problem. A burst of foreign aid money was spent on extra roads between villages some years ago. But the jungle overtakes roads relentlessly, so原创 2017-08-01 19:33:35 · 294 阅读 · 0 评论 -
Count The Pairs
With the 60th anniversary celebration of Nanjing University of Science and Technology coming soon, the university sets n tourist spots to welcome guests. Of course, Redwood forests in our university a原创 2017-08-03 20:13:43 · 347 阅读 · 0 评论 -
Fix a Tree CodeForces - 698B
A tree is an undirected connected graph without cycles. Let's consider a rooted undirected tree with n vertices, numbered 1 through n. There are many ways to represent such a tree. One way is to crea原创 2017-08-04 11:53:35 · 442 阅读 · 0 评论