![](https://img-blog.csdnimg.cn/20201014180756724.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
二分图
薄层
努力就有收获~
展开
-
HDU-1350 Taxi Cab Scheme(最小路径覆盖)
Running a taxi station is not all that simple. Apart from the obvious demand for a centralised coordination of the cabs in order to pick up the customers calling to get a cab as soon as possible, there is also a need to schedule all the taxi rides which ha原创 2017-10-31 19:49:33 · 329 阅读 · 0 评论 -
QDU-帅气的HYC与N皇后(最大独立集)
你一定听说过N皇后问题吧。但是帅气的HYC已经开始厌倦这古老的题目了。所以他设计了新的问题——N骑士问题。这个问题跟N皇后很类似,同样是在国际象棋的棋盘上,只是把皇后(Queen)换成了 骑士(Knight ♞),就相当于中国象棋里的马了(所以说还是叫马好了~),不过要特别注意的一点是,国际象棋里的马是不会被绊马腿的(如果你不知道我在说什么,请忽略这句,并看下一段,这并不影响你解决这个问题)。HYC会给出一个n行m列棋盘,你需要往棋盘上尽量放置更多的Knight,并保证他们无法相互攻击。下图原创 2017-07-27 11:59:49 · 404 阅读 · 0 评论 -
最小点覆盖集之例题
POJ-3041 Asteroids题意:给一个N*N的矩阵,一些星球位于一些点上,要求消除所有星球,每次操作可消除一行或一列的星球,求最少要几次。思路:以行和列为点,星球所在行和列的关系建边,建完图之后就会发现求最小点覆盖集。代码1:#include #include using namespace std;const int maxn = 505;int G原创 2017-07-26 20:44:54 · 1509 阅读 · 0 评论 -
HDU-3829 Cat VS Dog(最大独立集及对题目的分析)
The zoo have N cats and M dogs, today there are P children visiting the zoo, each child has a like-animal and a dislike-animal, if the child's like-animal is a cat, then his/hers dislike-animal must be a dog, and vice versa. Now the zoo administrator is r原创 2017-07-23 20:42:38 · 669 阅读 · 2 评论 -
最小路径覆盖问题求解及与最小边覆盖的区别
Air Raid + Treasure Exploration最小边覆盖:最小路径覆盖:有向无环图->二分图传递闭包原创 2017-07-22 23:57:32 · 4127 阅读 · 1 评论 -
二分图的概念汇总
二分图概念汇总--二分图:是这样一个图,其顶点可分为两集合X和Y,所有的边关联的两顶点中,恰一个属于X,另一个属于Y。同一集合的结点不相邻。匹配:图的一个匹配是一些边的集合,任意两条边没有公共点。最大匹配:包含边数最多的匹配。 (匈牙利算法)完美匹配:所有点都在匹配边上的匹配。完备匹配:在二分图中,X集合中的所有点都有对应的匹配或者是Y集合中的所有点都有原创 2017-05-21 00:43:14 · 638 阅读 · 0 评论 -
KM算法模板(二分图的最大权匹配)
又掌握了一个模板~~~其实是差不多理解了,比较菜..二次元霸主写博客就是强啊: http://www.cnblogs.com/wenruo/p/5264235.html但...不敢想象博主是男是女。依旧改成自己喜欢的模板格式~//模板HDU-2255 #include #include #include #include using namespace std;原创 2017-05-16 15:38:55 · 568 阅读 · 0 评论 -
无权二分图的最大匹配(匈牙利算法)
二分图的最大匹配——匈牙利算法,先来了解一下二分图,顾名思义,二分图是可以将所有点分成两个部分的图,怎么判断呢,可以这么来,我们暂且将红色和蓝色看成两种相反的颜色,将图中的某一个顶点涂为红色,然后将和它相连的顶点涂成黑色的颜色,即与它本身相反的颜色,继续如此,如果按照这种方法可以将全部顶点都着色的话,那么该图就是一个二分图。二分图的最大匹配,其实就是不断寻找增广路,增广路本质是一条路径上的原创 2017-03-08 23:45:17 · 452 阅读 · 0 评论 -
C-Cleaning Pipes(判断两线段相交+二分图判定) 2015-2016 Northwestern European Regional Contest (NWERC 2015)
Linköping has a quite complex water transport system.Around Linköping there are several wells from which wateris drawn. The water is then transported to other locationsusing pipes. Each pipe is a straight canal from one of thewells to some location in原创 2017-10-15 19:35:14 · 407 阅读 · 0 评论 -
HDU-1045 Fire Net(简单缩点+最大匹配)
Suppose that we have a square city with straight streets. A map of a city is a square board with n rows and n columns, each representing a street or a piece of wall. A blockhouse is a small castle that has four openings through which to shoot. The four o原创 2017-07-28 23:40:28 · 390 阅读 · 0 评论 -
HDU-2389 Rain on your Parade(二分图之Hopcroft-Karp算法)
You’re giving a party in the garden of your villa by the sea. The party is a huge success, and everyone is here. It’s a warm, sunny evening, and a soothing wind sends fresh, salty air from the sea. The evening is progressing just as you had imagined. It co原创 2017-07-30 14:23:04 · 334 阅读 · 0 评论 -
codeforces-510E Fox And Dinner(带限制的二分图多重匹配+奇偶建图+打印路径)
Fox Ciel is participating in a party in Prime Kingdom. There are n foxes there (include Fox Ciel). The i-th fox is ai years old.They will have dinner around some round tables. You want to distribute foxes such that:Each fox is sitting at some table.Each原创 2017-10-13 16:35:28 · 334 阅读 · 0 评论 -
HDU-3478 Catch(二分图染色+并查集)
A thief is running away!We can consider the city where he locates as an undirected graph in which nodes stand for crosses and edges stand for streets. The crosses are labeled from 0 to N–1. The tricky thief starts his escaping from cross S. Each moment h原创 2017-10-11 19:30:46 · 263 阅读 · 0 评论 -
HDU-3605 Escape(状态压缩+最大流求多重匹配、改版匈牙利算法)
2012 If this is the end of the world how to do? I do not know how. But now scientists have found that some stars, who can live, but some people do not fit to live some of the planet. Now scientists want your help, is to determine what all of people can liv原创 2017-10-04 20:07:35 · 349 阅读 · 0 评论 -
hihocoder-1393 二分图的多重匹配(网络流做法)
学校的秋季运动会即将开始,为了决定参赛人员,各个班又开始忙碌起来。小Hi和小Ho作为班上的班干部,统计分配比赛选手的重任也自然交到了他们手上。已知小Hi和小Ho所在的班级一共有N名学生(包含小Hi和小Ho),编号依次为1..N。运动会一共有M项不同的比赛,编号为1..M。第i项比赛每个班需要派出m[i]名选手参加。根据小Hi和小Ho的统计,编号为i的学生表示最多同时参加a[i]项比赛,并且给出他所擅长的b[i]项比赛的编号。小Hi和小Ho希望将每个学生都安排到他所擅长的比赛项目,以增加夺冠的可能性原创 2017-10-02 21:15:13 · 426 阅读 · 0 评论 -
FZU-2205 据说题目很水(思维、完全二分图性质避免三元环)
Sunday最近对图论特别感兴趣,什么欧拉回路什么哈密顿回路,又是环又是树。在看完一本书后,他对自己特别有信心,便找到大牛牛犇犇,希望他出一题来考考自己。在遥远的古代东方有N个城市,它们之间可以通过双向的道路相连。任意两个城市由不超过一条道路直接相连,而且没有城市的道路连向自身。但是牛犇犇是个纯情的小伙子,尽管他还没有女朋友,但他还是很讨厌第三者,以至于讨厌三这个数字。所以他希望Sunday能够构造一个N个城市的地图,这个地图中不能有任意三个城市能够相互直接到达,而且地图中的道路数目最多。牛犇犇考虑到S原创 2017-09-03 15:53:50 · 452 阅读 · 0 评论 -
HDU 2448 Mining Station on the Sea(最小费用最大流, KM算法)
The ocean is a treasure house of resources and the development of human society comes to depend more and more on it. In order to develop and utilize marine resources, it is necessary to build mining stations on the sea. However, due to seabed mineral resou原创 2017-08-14 22:59:26 · 425 阅读 · 0 评论 -
UVALive-5013 Similarity(二分图最大权匹配)
When we were children, we were always asked to do the classification homework. For example, wewere given words {Tiger, Panda, Potato, Dog, Tomato, Pea, Apple, Pear, Orange, Mango} and wewere required to classify these words into three groups. As you know原创 2017-08-05 23:50:11 · 335 阅读 · 0 评论 -
Codeforces-557D Vitaly and Cycle(二分图染色)
After Vitaly was expelled from the university, he became interested in the graph theory.Vitaly especially liked the cycles of an odd length in which each vertex occurs at most once.Vitaly was wondering how to solve the following problem. You are given an原创 2017-07-31 17:55:20 · 387 阅读 · 0 评论 -
POJ-1466 Girls and Boys(最大独立集)
n the second year of the university somebody started a study on the romantic relations between the students. The relation "romantically involved" is defined between one girl and one boy. For the study reasons it is necessary to find out the maximum set sat原创 2017-07-23 19:37:03 · 432 阅读 · 0 评论