
并查集+欧拉
sping-
这个作者很懒,什么都没留下…
展开
-
并查集详解
这个文章是几年前水acm的时候转的, 当时也不知道作者是谁, 要是有人知道的话说一下吧并查集是我暑假从高手那里学到的一招,觉得真是太精妙的设计了。以前我无法解决的一类问题竟然可以用如此简单高效的方法搞定。不分享出来真是对不起party了。(party:我靠,关我嘛事啊?我跟你很熟么?)来看一个实例,杭电1232畅通工程首先在地图上给你若干个城镇,这些城镇都可转载 2017-08-02 21:41:37 · 191 阅读 · 0 评论 -
A - 畅通工程
点击打开链接某省调查城镇交通状况,得到现有城镇道路统计表,表中列出了每条道路直接连通的城镇。省政府“畅通工程”的目标是使全省任何两个城镇间都可以实现交通(但不一定有直接的道路相连,只要互相间接通过道路可达即可)。问最少还需要建设多少条道路? Input测试输入包含若干测试用例。每个测试用例的第1行给出两个正整数,分别是城镇数目N ( 注意:两个城原创 2017-08-02 21:43:55 · 177 阅读 · 0 评论 -
B - Rikka with Graph
点击打开链接As we know, Rikka is poor at math. Yuta is worrying about this situation, so he gives Rikka some math tasks to practice. There is one of them: Yuta has a non-direct graph with n ve原创 2017-08-02 21:50:09 · 188 阅读 · 0 评论 -
D - How Many Tables
点击打开链接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 not all the friend原创 2017-08-02 21:54:20 · 182 阅读 · 0 评论