摘要: 分析:建一个远点,往每个点连建井的价值(单向边),其它输水线按照题意建单向边 然后以源点为根的权值最小的有向树就是答案,套最小树形图模板 #include <iostream> #include <algorithm> #include <cstdio> #include <cstdlib> #in 阅读全文
posted @ 2016-05-10 23:34 shuguangzw 阅读(140) 评论(0) 推荐(0) 编辑
摘要: 这个题就是需要求整个有向带权图的最小树形图,没有指定根,那就需要加一个虚根 这个虚根到每个点的权值是总权值+1,然后就可以求了,如果求出来的权值大于等于二倍的总权值,就无解 有解的情况,还需要输出最根,多解的情况,肯定是某个环上所有的点为根都可以(比如所有的点构成一个环), 这样加边的时候虚边的时候 阅读全文
posted @ 2016-05-10 22:31 shuguangzw 阅读(165) 评论(0) 推荐(0) 编辑
摘要: 最小树形图模板题 #include <iostream> #include <algorithm> #include <cstdio> #include <cstdlib> #include <cstring> #include <string> #include <stack> #include 阅读全文
posted @ 2016-05-10 21:16 shuguangzw 阅读(130) 评论(0) 推荐(0) 编辑
摘要: 最小树形图,就是给有向带权图中指定一个特殊的点root,求一棵以root为根的有向生成树T,并且T中所有边的总权值最小。 朱刘算法模板题 #include <iostream> #include <algorithm> #include <cstdio> #include <cstdlib> #in 阅读全文
posted @ 2016-05-10 18:17 shuguangzw 阅读(160) 评论(0) 推荐(0) 编辑
摘要: 模板题 #include <iostream> #include <algorithm> #include <cstdio> #include <cstdlib> #include <cstring> #include <string> #include <stack> #include <queu 阅读全文
posted @ 2016-05-10 11:20 shuguangzw 阅读(156) 评论(0) 推荐(0) 编辑
摘要: 又是求次小生成树,就是求出最小生成树,然后枚举不在最小生成树上的每条边,求出包含着条边的最小生成树,然后取一个最小的 #include <iostream> #include <algorithm> #include <cstdio> #include <cstdlib> #include <cst 阅读全文
posted @ 2016-05-10 11:00 shuguangzw 阅读(123) 评论(0) 推荐(0) 编辑