摘要: 求最大独立集。二分图的独立数等于顶点数减去最大匹配数。由于此题中不明男女,所以把所有人弄成两个集合,故最后要减去最大匹配数的一半。View Code 1 /* 2 Author:Zhaofa Fang 3 Lang:C++ 4 */ 5 #include <cstdio> 6 #include <cstdlib> 7 #include <iostream> 8 #include <cmath> 9 #include <cstring>10 #include <algorithm>11 #include <string 阅读全文
posted @ 2012-08-08 21:15 發_ 阅读(154) 评论(0) 推荐(0)
摘要: 二分图基础。求二分图最大匹配(匈牙利算法)。View Code 1 /* 2 Author:Zhaofa Fang 3 Lang:C++ 4 */ 5 #include <cstdio> 6 #include <cstdlib> 7 #include <iostream> 8 #include <cmath> 9 #include <cstring>10 #include <algorithm>11 #include <string>12 #include <vector>13 #include & 阅读全文
posted @ 2012-08-08 13:31 發_ 阅读(152) 评论(0) 推荐(0)