摘要: 1 /* 2 这个题目有点意思 3 4 构图需分析,和3041有区别 5 6 3041,是一行可以覆盖。所以在那个题目中,每行和列可作为顶点 7 8 现在的题目,是每段可覆盖,所以每个段作为顶点,如果交叉则有边。 9 10 这样图就构成了 11 */ 12 13 // include file 14 #include <cstdio> 15 #include <cstdlib> 16 #include <cstring> 17 #include <cmath> 18 #include <cctype> 19 #include < 阅读全文
posted @ 2011-03-04 21:39 AC2012 阅读(1327) 评论(0) 推荐(0) 编辑
摘要: 1 /* 2 建图,然后二分匹配。求最小点覆盖转化为求最大匹配 3 hungarian算法 4 */ 5 // include file 6 #include <cstdio> 7 #include <cstdlib> 8 #include <cstring> 9 #include <cmath> 10 #include <cctype> 11 #include <ctime> 12 13 #include <iostream> 14 #include <sstream> 15 #include & 阅读全文
posted @ 2011-03-04 19:56 AC2012 阅读(259) 评论(0) 推荐(0) 编辑
摘要: 1 /* 2 还有17个 3 4 求最小的顶点覆盖 ,也就是最大匹配,hungarian算法上 5 6 建图的时候,如果有一边是0,说明是开始状态,无须在算 7 */ 8 9 // include file 10 #include <cstdio> 11 #include <cstdlib> 12 #include <cstring> 13 #include <cmath> 14 #include <cctype> 15 #include <ctime> 16 17 #include <iostream> 18 阅读全文
posted @ 2011-03-04 15:57 AC2012 阅读(430) 评论(0) 推荐(0) 编辑
摘要: 1 /* 2 要求的是最大独立集 3 4 最大独立集+最小顶点覆盖(最大匹配) = 顶点数 5 6 所以最后的结果为 (顶点数-最大匹配)/2 7 */ 8 9 // include file 10 #include <cstdio> 11 #include <cstdlib> 12 #include <cstring> 13 #include <cmath> 14 #include <cctype> 15 #include <ctime> 16 17 #include <iostream> 18 #inclu 阅读全文
posted @ 2011-03-04 15:10 AC2012 阅读(416) 评论(0) 推荐(0) 编辑
摘要: 1 /* 2 找出最少的顶点把所有的边都覆盖了 3 最小顶点覆盖问题= 最大匹配问题 4 可hungarian算法来解决 5 采用邻接标 O(N*M) 6 */ 7 8 // include file 9 #include <cstdio> 10 #include <cstdlib> 11 #include <cstring> 12 #include <cmath> 13 #include <cctype> 14 #include <ctime> 15 16 #include <iostream> 17 #in 阅读全文
posted @ 2011-03-04 14:29 AC2012 阅读(287) 评论(0) 推荐(0) 编辑
摘要: 1 /* 2 最大独立集+顶点最小覆盖(最大匹配)=顶点数 3 4 问题的本质回归为 求二分图的最大匹配了 5 6 二分图的最大匹配,可以用hungarian algorithm或者最大流算法来求 7 */ 8 9 // include file 10 #include <cstdio> 11 #include <cstdlib> 12 #include <cstring> 13 #include <cmath> 14 #include <cctype> 15 #include <ctime> 16 17 #include 阅读全文
posted @ 2011-03-04 14:05 AC2012 阅读(548) 评论(0) 推荐(0) 编辑