
二分图最大匹配
文章平均质量分 72
Unin88
这个作者很懒,什么都没留下…
展开
-
hdu 3081 Marriage Match II
acm.hdu.edu.cn/showproblem.php?pid=3081并查集+二分匹配是朋友关系的女孩合并为一个集合来降低建图的时间复杂度。然后判断最大匹配数是不是n,如果是的话更新图的流量重新匹配,不是的话输出答案。AC代码:#include #include #include #include using namespace std;const int V原创 2015-01-08 19:47:08 · 379 阅读 · 0 评论 -
poj 2239 Selecting Courses
poj.org/problem?id=2239A集合代表课程 B集合代表 这就是一个二分图 由于课程和时间必须一一对应不能重叠 因此是二分图的最大匹配问题。做法有两种:1.网络流的特殊化建立一个S和T,S连课程,课程连时间,时间连T,每条边的流量都是1,则最大流就是最大匹配数。#include #include #include #include using namesp原创 2015-01-08 16:02:55 · 379 阅读 · 0 评论 -
hdu 2444 The Accomodation of Students
acm.hdu.edu.cn/showproblem.php?pid=2444判断二分图+二分图最大匹配#include #include #include #include using namespace std;const int MAXV = 510;const int MAXE = 10010;int mark[MAXV];int A[MAXV],B[MAXV原创 2015-01-09 13:41:10 · 346 阅读 · 0 评论 -
hdu 3729 I'm Telling the Truth
acm.hdu.edu.cn/showproblem.php?pid=3729要求输出字典序最大的那个结果 所以逆向进行二分匹配。#include #include #include #include using namespace std;int n,l,r,G[61][100010],t[61],cnt;int check[100010],ma[61],mb[10001原创 2015-01-09 15:52:11 · 457 阅读 · 0 评论 -
hdu 2063 过山车
acm.hdu.edu.cn/showproblem.php?pid=2063二分图最大匹配#include #include #include #include using namespace std;const int V = 510;const int E = 1010;int k,n,m,G[V][V];int check[V],ma[V],mb[V];原创 2015-01-09 14:41:13 · 422 阅读 · 0 评论