
并查集
Evildoer_llc
这个作者很懒,什么都没留下…
展开
-
hdu 1213 How Many Tables(简单并查集)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1213题意就是 给出n对关系,假如A和B认识,B和C认识,那么A和B认识。现在互相认识的人可以在一桌吃饭,不互相认识的人可以一桌吃饭,问需要多少张桌子#pragma GCC optimize(2)#include<stdio.h>#include<algorithm&g...原创 2018-10-02 21:35:24 · 149 阅读 · 0 评论 -
poj 1611 The Suspects(简单并查集)
题目链接:http://poj.org/problem?id=1611Severe acute respiratory syndrome (SARS), an atypical pneumonia of unknown aetiology, was recognized as a global threat in mid-March 2003. To minimize transmissio...原创 2018-11-18 21:43:11 · 146 阅读 · 0 评论 -
hdu 3635 Dragon Balls(高级并查集)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=3635 Five hundred years later, the number of dragon balls will increase unexpectedly, so it's too difficult for Monkey King(WuKong) to gather all o...原创 2018-10-17 01:16:59 · 433 阅读 · 0 评论 -
hdu 3047 Zjnu Stadium(高级并查集)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=3047 In 12th Zhejiang College Students Games 2007, there was a new stadium built in Zhejiang Normal University. It was a modern stadium which could...原创 2018-10-17 01:15:45 · 199 阅读 · 0 评论 -
hdu 3038 How Many Answers Are Wrong (种类并查集)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=3038 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...原创 2018-10-17 01:13:55 · 178 阅读 · 0 评论 -
hdu 3081 Marriage Match II (二分图最大匹配+并查集)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=3081t题意:有N个女孩要与N个男孩玩配对游戏.每个女孩有一个可选男孩的集合(即该女孩可以选自己集合中的任意一个男孩作为该轮的搭档).然后从第一轮开始,每个女孩都要和一个不同的男孩配对.如果第一轮N个女孩都配对成功,那么就开始第二轮配对,女孩依然从自己的备选男孩集合中选择,但是不能选那些已经被...原创 2018-10-15 02:08:05 · 217 阅读 · 0 评论 -
第六届河南省程序设计大赛 C 最舒适的路线 -并查集
异形卵潜伏在某区域的一个神经网络中。其网络共有N个神经元(编号为1,2,3,…,N),这些神经元由M条通道连接着。两个神经元之间可能有多条通道。异形卵可以在这些通道上来回游动,但在神经网络中任一条通道的游动速度必须是一定的。当然异形卵不希望从一条通道游动到另一条通道速度变化太大,否则它会很不舒服。现在异形卵聚居在神经元S点,想游动到神经元T点。它希望选择一条游动过程中通道最大速度与最小速度比尽...原创 2018-05-16 00:43:04 · 217 阅读 · 0 评论 -
51nod 1204 Parity(并查集)
你的朋友写下一串包含1和0的串让你猜,你可以从中选择一个连续的子串(例如其中的第3到第5个数字)问他,该子串中包含了奇数个还是偶数个1,他会回答你的问题,然后你可以继续提问......你怀疑朋友的答案可能有错,或说同他之前的答案相互矛盾,例如:1 - 2 奇数,3 - 4 奇数,那么可以确定1 - 4 一定是偶数,如果你的朋友回答是奇数,就产生了矛盾。给出所有你朋友的答案,请你找出第一个出现矛盾...原创 2018-09-12 00:21:01 · 373 阅读 · 0 评论 -
hdu 3172 Virtual Friends(并查集+map)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=3172 These days, you can do all sorts of things online. For example, you can use various websites to make virtual friends. For some people, growing...原创 2018-10-06 13:58:56 · 363 阅读 · 0 评论 -
hdu 1856 More is better(并查集)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1856 Mr Wang wants some boys to help him with a project. Because the project is rather complex, the more boys come, the better it will be. Of cours...原创 2018-10-06 13:51:50 · 137 阅读 · 0 评论 -
hdu 1325 Is It A Tree? (并查集)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1325 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 ...原创 2018-10-06 13:24:09 · 269 阅读 · 0 评论 -
hdu 1232 畅通工程(并查集)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1232 某省调查城镇交通状况,得到现有城镇道路统计表,表中列出了每条道路直接连通的城镇。省政府“畅通工程”的目标是使全省任何两个城镇间都可以实现交通(但不一定有直接的道路相连,只要互相间接通过道路可达即可)。问最少还需要建设多少条道路? Input 测...原创 2018-10-06 13:20:57 · 191 阅读 · 0 评论 -
2018 百度之星复赛 C题 带劲的and和(并查集+安位贡献)
度度熊专门研究过“动态传递闭包问题”,他有一万种让大家爆蛋的方法;但此刻,他只想出一道简简单单的题——至繁,归于至简。度度熊有一张n个点m条边的无向图,第iii个点的点权为viv_ivi。如果图上存在一条路径使得点iii可以走到点jjj,则称i,ji,ji,j是带劲的,记f(i,j)=1f(i,j)=1f(i,j)=1;否则f(i,j)=0f(i,j)=0f(i,j)=0。显然有f...原创 2018-09-13 01:17:22 · 228 阅读 · 0 评论 -
hdu 1272 小希的迷宫 (简单并查集)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1272给出一张图,问时候符合条件。#pragma GCC optimize(2)#include<stdio.h>#include<algorithm>#include<string.h>#include<queue>using na...原创 2018-10-02 21:38:27 · 290 阅读 · 0 评论 -
poj 2524 Ubiquitous Religions (简单并查集)
题目链接:http://poj.org/problem?id=2524There are so many different religions in the world today that it is difficult to keep track of them all. You are interested in finding out how many different reli...原创 2018-11-18 21:44:27 · 184 阅读 · 0 评论