匈牙利算法
xuanweiace
一个热爱算法竞赛的弱校ACMer路过。青大本,浙大硕,方向后端开发,菜鸡一枚,奋斗ing...
展开
-
算法讲解 -- 二分图之 匈牙利算法
匈牙利算法是由匈牙利数学家Edmonds于1965年提出,因而得名。匈牙利算法是基于Hall定理中充分性证明的思想,它是部图匹配最常见的算法,该算法的核心就是寻找增广路径,它是一种用增广路径求二分图最大匹配的算法。-------等等,看得头大?那么请看下面的版本: 通过数代人的努力,你终于赶上了剩男剩女的大潮,假设你是一位光荣的新世纪媒人,在你的手上有N个剩男,M个剩女,每个人都可能对...转载 2018-10-04 16:09:17 · 762 阅读 · 0 评论 -
【2018ACM山东省赛 - B】Bullet(二分 + 二分图匹配,匈牙利算法,卡常)
题干:Problem DescriptionIn GGO, a world dominated by gun and steel, players are fighting for the honor of being the strongest gunmen. Player Shino is a sniper, and her aimed shot kills one monster a...原创 2019-05-09 21:27:13 · 425 阅读 · 1 评论 -
【POJ - 1486】Sorting Slides(思维建图,二分图求必须边,关建边,图论)
题干:Professor Clumsey is going to give an important talk this afternoon. Unfortunately, he is not a very tidy person and has put all his transparencies on one big heap. Before giving the talk, he has...原创 2019-05-04 21:13:32 · 241 阅读 · 0 评论 -
【POJ - 3020】Antenna Placement (匈牙利算法,二分图最小边覆盖)
题干:The Global Aerial Research Centre has been allotted the task of building the fifth generation of mobile phone nets in Sweden. The most striking reason why they got the job, is their discovery of ...原创 2019-05-04 16:49:27 · 241 阅读 · 0 评论 -
【BZOJ - 1059】矩阵游戏(二分图匹配,建图,最小边覆盖)
题干: 小Q是一个非常聪明的孩子,除了国际象棋,他还很喜欢玩一个电脑益智游戏——矩阵游戏。矩阵游戏在一个N*N黑白方阵进行(如同国际象棋一般,只是颜色是随意的)。每次可以对该矩阵进行两种操作:行交换操作:选择矩阵的任意两行,交换这两行(即交换对应格子的颜色)列交换操作:选择矩阵的任意行列,交换这两列(即交换对应格子的颜色)游戏的目标,即通过若干次操作,使得方阵的主对角线(左上角到...原创 2019-05-04 14:33:11 · 352 阅读 · 0 评论 -
【HDU - 5090】Game with Pearls (匈牙利算法,二分图匹配)
题干:Tom and Jerry are playing a game with tubes and pearls. The rule of the game is:1) Tom and Jerry come up together with a number K.2) Tom provides N tubes. Within each tube, there are several ...原创 2019-03-16 10:46:18 · 200 阅读 · 0 评论 -
【 HDU - 5093】Battle ships(匈牙利算法,二分图匹配)
题干:Dear contestant, now you are an excellent navy commander, who is responsible of a tough mission currently.Your fleet unfortunately encountered an enemy fleet near the South Pole where the geogr...原创 2019-03-16 09:33:43 · 222 阅读 · 0 评论 -
【HDU - 5943】Kingdom of Obsession(数论,素数间隔结论,构造,思维,匈牙利算法,匹配问题)
题干:There is a kindom of obsession, so people in this kingdom do things very strictly.They name themselves in integer, and there arennpeople with their id continuous(s+1,s+2,⋯,s+n)(s+1,s+2,⋯,s+n...原创 2019-03-10 16:27:14 · 280 阅读 · 0 评论 -
【HDU - 4185】Oil Skimming (二分图,建图,匈牙利算法)
题干:Thanks to a certain "green" resources company, there is a new profitable industry of oil skimming. There are large slicks of crude oil floating in the Gulf of Mexico just waiting to be scooped up...原创 2018-10-17 00:43:32 · 227 阅读 · 0 评论 -
【POJ - 2226】Muddy Fields(匈牙利算法 或 网络流dinic,二分图匹配,最小点覆盖,矩阵中优秀的建图方式 )
题干:Rain has pummeled the cows' field, a rectangular grid of R rows and C columns (1 <= R <= 50, 1 <= C <= 50). While good for the grass, the rain makes some patches of bare earth quite m...原创 2018-10-15 21:05:26 · 364 阅读 · 0 评论 -
【HDU - 1281 】棋盘游戏 (经典的二分图匹配,匈牙利算法,枚举删除顶点,必须边,关建边)
题干:小希和Gardon在玩一个游戏:对一个N*M的棋盘,在格子里放尽量多的一些国际象棋里面的“车”,并且使得他们不能互相攻击,这当然很简单,但是Gardon限制了只有某些格子才可以放,小希还是很轻松的解决了这个问题(见下图)注意不能放车的地方不影响车的互相攻击。所以现在Gardon想让小希来解决一个更难的问题,在保证尽量多的“车”的前提下,棋盘里有些格子是可以避开的,也就是说,不在这些格...原创 2018-10-14 16:36:53 · 437 阅读 · 0 评论 -
【HDU - 2444】The Accomodation of Students(二分图判断 + 匈牙利算法求最大匹配)
题干:There are a group of students. Some of them may know each other, while others don't. For example, A and B know each other, B and C know each other. But this may not imply that A and C know each o...原创 2018-10-25 22:53:16 · 252 阅读 · 0 评论 -
【FZU - 2039】Pets(二分图匹配,水题)
题干:有n个人,m条狗,然后会给出有一些人不喜欢一些狗就不会购买,问最多能卖多少狗。。InputThere is a single integer T in the first line of the test data indicating that there are T(T≤100) test cases. In the first line of each test case,...原创 2019-05-07 22:27:48 · 189 阅读 · 0 评论