![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
并查集
文章平均质量分 61
Davenny
O ever youthful,O ever weeping.
展开
-
CodeForces 25D Roads not only in Berland
Description Berland Government decided to improve relations with neighboring countries. First of all, it was decided to build new roads so that from each city of Berland and neighboring countries it b原创 2017-07-07 08:39:47 · 347 阅读 · 0 评论 -
并查集
Description When ALPC42 got to a panzer brigade, He was asked to build software to help them regroup the battalions or companies. As the tradition of army, soldiers are rated according his or her ab原创 2016-07-08 18:11:08 · 301 阅读 · 0 评论 -
hdu4424:并查集
Description The wheel of the history rolling forward, our king conquered a new region in a distant continent. There are N towns (numbered from 1 to N) in this region connected by several roads. It’s原创 2016-08-11 21:11:47 · 342 阅读 · 0 评论 -
UVALive 6437并查集
题目大意: n个点,其中有k个发电站,然后给你m条无向边,要求使得每个地点可以接到电,求最小花费;思路: 比赛的时候硬是没想出来,用最小生成树做,而且用的还是prime,简直傻叉!!!! 我们可以将可以发电的地方合并成一个点,因为不算点的相对差异,你连到哪一个点都是等效的,然后用最小生成的另外一种做法;#include <cstdio>#include <algorithm>#includ原创 2016-08-27 20:59:31 · 491 阅读 · 0 评论 -
hdu 2473并查集的删除操作
题目大意: 有两种操作1:将两个相似的邮件合并,并且这种关系可以传递; 2:将某一个点孤立起来(即从关系集合中删除); 思路: 由于并查集是一种树形结构,单独直接将某一点从关系集合中删除较为复杂,那么就可以将要删除的那个点设为虚点,即将其映射到一个新的点上,即成为孤立的点;#include<iostream>#include<cstdio>#incl转载 2016-08-24 08:55:41 · 340 阅读 · 0 评论 -
ZOJ 3761 —— Easy billiards(并查集+深搜)
题目:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=3761桌面上有N个球,每次可以使某个球向上,下,左,右四个方向运动,但是不能让它离开桌面。当它与另一个球碰撞时,被碰撞的球就会沿着原先球的方向滚动,原先的球会停止在被碰撞的球的位置上。而被碰撞的球可以去碰撞其他球,或是离开桌面。题目要问最少能剩下几个球,并且输出一种操作方转载 2017-08-07 14:01:46 · 347 阅读 · 0 评论 -
poj3728并查集+LCA
题目大意: 对于一棵树,树上的每点都有一个权值,对于一个询问u,v,求从u 点到v点的路径上进行买卖所能得到的最大值,并且,买在卖之前。 There are N cities in a country, and there is one and only one simple path between each pair of cities. A merchant has chosen some原创 2017-08-30 16:30:46 · 307 阅读 · 0 评论