随笔分类 - 数据结构_并查集
摘要:Description In order to strengthen the defense ability, many stars in galaxy allied together and built many bidirectional tunnels to exchange messages
阅读全文
摘要:Description You are given an undirected graph consisting of n vertices and m edges. Your task is to find the number of connected components which are
阅读全文
摘要:Problem Description: Problem Description: 呃......变形课上Harry碰到了一点小麻烦,因为他并不像Hermione那样能够记住所有的咒语而随意的将一个棒球变成刺猬什么的,但是他发现了变形咒语的一个统一规律:如果咒语是以a开头b结尾的一个单词,那么它的作
阅读全文
摘要:Problem Description: A国有n座城市,编号为1~n,这n个城市之间没有任何交通线路,所以不同城市的居民之间不能互通,所以A国的人打算为这n个城市建立k条交通线(两座城市之间可以有两条及以上的线路),交通线只能贯穿两座城市p, q(存在p=q的情况,不用考虑但会占用一条交通线),
阅读全文
摘要:Problem Description 上次Gardon的迷宫城堡小希玩了很久(见Problem B),现在她也想设计一个迷宫让Gardon来走。但是她设计迷宫的思路不一样,首先她认为所有的通道都应该是双向连通的,就是说如果有一个通道连通了房间A和B,那么既可以通过它从房间A走到房间B,也可以通过它
阅读全文
摘要:Problem Description 某省调查城镇交通状况,得到现有城镇道路统计表,表中列出了每条道路直接连通的城镇。省政府“畅通工程”的目标是使全省任何两个城镇间都可以实现交通(但不一定有直接的道路相连,只要互相间接通过道路可达即可)。问最少还需要建设多少条道路? Input 测试输入包含若干测
阅读全文
摘要: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
阅读全文