![](https://img-blog.csdnimg.cn/20201014180756757.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
并查集
文章平均质量分 83
您还不是尊贵的会员身份
这个作者很懒,什么都没留下…
展开
-
并查集之求连通块的数量 HDU1232 畅通工程
畅通工程 Problem Description 某省调查城镇交通状况,得到现有城镇道路统计表,表中列出了每条道路直接连通的城镇。省政府“畅通工程”的目标是使全省任何两个城镇间都可以实现交通(但不一定有直接的道路相连,只要互相间接通过道路可达即可)。问最少还需要建设多少条道路? Input 测试输入包含若干测试用例。每个测试用例的第1行给出两个正整数,分别是城镇数目N ( < ...原创 2018-02-10 21:37:25 · 215 阅读 · 0 评论 -
并查集之求连通块的数量 HDU - 1213 How Many Tables
How Many Tables Problem Description Today is Ignatius’ birthday. He invites a lot of friends. Now it’s dinner time. Ignatius wants to know how many tables he needs at least. You have to notice that ...原创 2018-02-10 21:40:59 · 262 阅读 · 0 评论 -
并查集之关系分类 POJ - 1182 食物链
食物链 动物王国中有三类动物A,B,C,这三类动物的食物链构成了有趣的环形。A吃B, B吃C,C吃A。 现有N个动物,以1-N编号。每个动物都是A,B,C中的一种,但是我们并不知道它到底是哪一种。 有人用两种说法对这N个动物所构成的食物链关系进行描述: 第一种说法是”1 X Y”,表示X和Y是同类。 第二种说法是”2 X Y”,表示X吃Y。 此人对N个动物,用上述两种说法,一...原创 2018-02-10 21:47:57 · 147 阅读 · 0 评论 -
并查集之关系分类 POJ - 1703 Find them, Catch them
Find them, Catch them The police office in Tadu City decides to say ends to the chaos, as launch actions to root up the TWO gangs in the city, Gang Dragon and Gang Snake. However, the police first ne...原创 2018-02-10 21:50:35 · 293 阅读 · 0 评论