
二分图匹配
文章平均质量分 80
别动我的白羊毛
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
KM算法模板
转自:http://www.cnblogs.com/wenruo/p/5264235.html 这是hdu2255 #include<cstdio> #include<cstring> #include<cmath> #include<iostream> #include<algorithm> using namespace st...转载 2017-09-27 15:09:38 · 268 阅读 · 0 评论 -
匈牙利算法模板
来自:http://www.renfei.org/blog/bipartite-matching.html 这篇文章讲无权二分图(unweighted bipartite graph)的最大匹配(maximum matching)和完美匹配(perfect matching),以及用于求解匹配的匈牙利算法(Hungarian Algorithm);不讲带权二分图的最佳匹配。 二分图...转载 2017-09-29 15:14:08 · 1059 阅读 · 0 评论 -
hdu1068 Girls and Boys(最大匹配)
来自:http://blog.youkuaiyun.com/chang_mu/article/details/40262109 Girls and Boys Time Limit: 20000/10000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 7710 ...转载 2017-09-30 19:31:44 · 233 阅读 · 0 评论 -
牛客网暑期ACM多校训练营(第五场)E-room(带权二分图匹配)
链接:https://www.nowcoder.com/acm/contest/143/E 来源:牛客网 题目描述 Nowcoder University has 4n students and n dormitories ( Four students per dormitory). Students numbered from 1 to 4n. And in the first ye...原创 2018-08-02 19:56:16 · 300 阅读 · 0 评论 -
hdu 2853 Assignment(旧边优先)
这里有一份优秀的题解:HDU 2853 Assignment(二分图最优匹配:优先用原匹配边) Last year a terrible earthquake attacked Sichuan province. About 300,000 PLA soldiers attended the rescue, also ALPCs. Our mission is to solve difficul...原创 2018-07-28 20:31:22 · 201 阅读 · 0 评论 -
hdu2853 Assignment
思路来自:http://www.cnblogs.com/kane0526/p/3263248.html 题意:有n个公司,m个任务,每个公司做每个任务都有一个效率值,最开始每个公司都指派了一个任务,现在要你重新给每个公司分配一个任务(一个任务只能分配给一家公司),使得所有公司任务的效率值最大,并且改变的原始任务最少。 思路:把每条边的权值扩大k倍(k>n),然后属于原始任原创 2017-09-27 20:12:03 · 208 阅读 · 0 评论 -
hdu2426 Interesting Housing Problem
之前用的那个模板是完全匹配,然后点的个数都用的N,这题有N,M,自己改了一下板子,结果改错了,索性换一个 这个板子来自http://www.cnblogs.com/someblue/p/4027628.html 是hdu1853的题解的代码修改得到的 #include #include #include #include #include #include #include原创 2017-09-27 19:36:48 · 229 阅读 · 0 评论 -
hdu3435 A new Graph Game
和hdu3488真是一毛一样 #include #include #include #include #include using namespace std; const int MAXN = 1005; const int INF = 0x3f3f3f3f; int love[MAXN][MAXN]; // 记录每个妹子和每个男生的好感度 int ex_girl[MAXN];原创 2017-09-27 17:49:32 · 210 阅读 · 0 评论 -
hdu1853 Cyclic Tour
思路来自:http://www.cnblogs.com/someblue/p/4027628.html 题意:给一个有向有权图,选一些边使得每个点都在且只在一个环之中,且要求权值走过的边的权值最小 思路: 可以发现,每个点的入度和出度都是1。 如果每个点都拆成入点和出点,对于点u,可以拆成u和u’, u是入点,u’是出点。 若有边(原创 2017-09-27 16:31:58 · 218 阅读 · 0 评论 -
Gym 101873F Plug It In(二分图匹配,匈牙利算法)
题目链接:Gym - 101873F Sample Input 1 3 6 8 1 1 1 2 1 3 2 3 2 4 3 4 3 5 3 6 Sample Output 1 5 Sample Input 2 4 5 11 1 1 1 2 1 3 2 1 2 2 2 3 3 1 3 2 3 3 4 4 4 5 Sample Output 2 5 Sample Input 3...原创 2018-10-06 19:17:57 · 384 阅读 · 0 评论