图论
creator平
期望破茧成蝶时的飞翔,向往突破蝉蛹后的鸣叫。
展开
-
hdu1596 find the safest road (最短路)
XX星球有很多城市,每个城市之间有一条或多条飞行通道,但是并不是所有的路都是很安全的,每一条路有一个安全系数s,s是在 0 和 1 间的实数(包括0,1),一条从u 到 v 的通道P 的安全度为Safe(P) = s(e1)*s(e2)…*s(ek) e1,e2,ek是P 上的边 ,现在8600 想出去旅游,面对这这么多的路,他想找一条最安全的路。但是8600 的数学不好,想请你帮忙 ^_^I...原创 2018-07-17 10:52:12 · 135 阅读 · 0 评论 -
HDU - 2063 过山车(二分图最大匹配模板)
RPG girls今天和大家一起去游乐场玩,终于可以坐上梦寐以求的过山车了。可是,过山车的每一排只有两个座位,而且还有条不成文的规矩,就是每个女生必须找个个男生做partner和她同坐。但是,每个女孩都有各自的想法,举个例子把,Rabbit只愿意和XHD或PQK做partner,Grass只愿意和linle或LL做partner,PrincessSnow愿意和水域浪子或伪酷儿做partner。考虑...原创 2018-07-21 15:08:10 · 132 阅读 · 0 评论 -
HDU - 2819(二分图匹配)
Given an N*N matrix with each entry equal to 0 or 1. You can swap any two rows or any two columns. Can you find a way to make all the diagonal entries equal to 1?InputThere are several test cases ...原创 2018-07-26 17:46:32 · 291 阅读 · 0 评论 -
hdu2255 奔小康赚大钱(二分图带权匹配,KM算法)
传说在遥远的地方有一个非常富裕的村落,有一天,村长决定进行制度改革:重新分配房子。这可是一件大事,关系到人民的住房问题啊。村里共有n间房间,刚好有n家老百姓,考虑到每家都要有房住(如果有老百姓没房子住的话,容易引起不安定因素),每家必须分配到一间房子且只能得到一间房子。另一方面,村长和另外的村领导希望得到最大的效益,这样村里的机构才会有钱.由于老百姓都比较富裕,他们都能对每一间房子在他们的经济...原创 2018-08-03 18:18:55 · 108 阅读 · 0 评论 -
Strategic Game 二分匹配+HK优化
Bob enjoys playing computer games, especially strategic games, but sometimes he cannot find the solution fast enough and then he is very sad. Now he has the following problem. He must defend a medieva...原创 2018-07-31 11:11:19 · 134 阅读 · 0 评论 -
HDU 2389 Rain on your Parade(二分匹配+Hopcroft-Carp)(模板题)
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. Th...原创 2018-07-28 11:07:57 · 459 阅读 · 1 评论 -
Hdu3829 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 b...原创 2018-08-02 09:34:13 · 108 阅读 · 0 评论 -
poj 2594 Treasure Exploration(最大相交路径覆盖)
Have you ever read any book about treasure exploration? Have you ever see any film about treasure exploration? Have you ever explored treasure? If you never have such experiences, you would never know...原创 2018-08-01 09:39:21 · 153 阅读 · 0 评论 -
poj 1422 Air Raid (最小不相交路径覆盖)
Consider a town where all the streets are one-way and each street leads from one intersection to another. It is also known that starting from an intersection and walking through town's streets you can...原创 2018-08-01 09:34:36 · 116 阅读 · 0 评论 -
POJ 2289 Jamie's Contact Groups (二分多重匹配)
Jamie is a very popular girl and has quite a lot of friends, so she always keeps a very long contact list in her cell phone. The contact list has become so long that it often takes a long time for her...原创 2018-08-02 11:12:42 · 609 阅读 · 6 评论 -
POJ_2112_Optimal Milking(二分图多重匹配)
FJ has moved his K (1 <= K <= 30) milking machines out into the cow pastures among the C (1 <= C <= 200) cows. A set of paths of various lengths runs among the cows and the milking machine...原创 2018-08-02 17:47:01 · 160 阅读 · 0 评论 -
HDU - 1285——确定比赛名次
有N个比赛队(1<=N<=500),编号依次为1,2,3,。。。。,N进行比赛,比赛结束后,裁判委员会要将所有参赛队伍从前往后依次排名,但现在裁判委员会不能直接获得每个队的比赛成绩,只知道每场比赛的结果,即P1赢P2,用P1,P2表示,排名时P1在P2之前。现在请你编程序确定排名。Input输入有若干组,每组中的第一行为二个数N(1<=N<=500),M;其中N表示...原创 2018-10-26 19:57:22 · 72 阅读 · 0 评论 -
hdu 1281 棋盘游戏 (二分图匹配)
小希和Gardon在玩一个游戏:对一个N*M的棋盘,在格子里放尽量多的一些国际象棋里面的“车”,并且使得他们不能互相攻击,这当然很简单,但是Gardon限制了只有某些格子才可以放,小希还是很轻松的解决了这个问题(见下图)注意不能放车的地方不影响车的互相攻击。所以现在Gardon想让小希来解决一个更难的问题,在保证尽量多的“车”的前提下,棋盘里有些格子是可以避开的,也就是说,不在这些格子上放车,也...原创 2018-07-26 11:06:18 · 124 阅读 · 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 a new...原创 2018-07-29 09:57:51 · 105 阅读 · 0 评论 -
hdu 1045 Fire Net(二分图匹配||DFS)
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 tha...原创 2018-07-26 10:03:00 · 108 阅读 · 0 评论 -
BZOJ1003 物流运输(DP+最短路)
物流公司要把一批货物从码头A运到码头B。由于货物量比较大,需要n天才能运完。货物运输过程中一般要转停好几个码头。物流公司通常会设计一条固定的运输路线,以便对整个运输过程实施严格的管理和跟踪。由于各种因素的存在,有的时候某个码头会无法装卸货物。这时候就必须修改运输路线,让货物能够按时到达目的地。但是修改路线是一件十分麻烦的事情,会带来额外的成本。因此物流公司希望能够订一个n天的运输计划,使得...原创 2018-07-18 10:11:03 · 538 阅读 · 0 评论 -
hdu 1595 find the longest of the shortest(Dijkstra+枚举)
Marica is very angry with Mirko because he found a new girlfriend and she seeks revenge.Since she doesn't live in the same city, she started preparing for the long journey.We know for every road how m...原创 2018-07-18 11:00:16 · 103 阅读 · 0 评论 -
poj 3013 Big Christmas Tree (最短路)
Christmas is coming to KCM city. Suby the loyal civilian in KCM city is preparing a big neat Christmas tree. The simple structure of the tree is shown in right picture.The tree can be represented as...原创 2018-07-18 16:51:21 · 146 阅读 · 0 评论 -
POJ 3522 Slim Span(枚举生成树)
Given an undirected weighted graph G, you should find one of spanning trees specified as follows.The graph G is an ordered pair (V, E), where V is a set of vertices {v1, v2, …, vn} and E is a set of...原创 2018-07-18 17:55:02 · 207 阅读 · 0 评论 -
HDU 2647 Reward(拓扑排序)
Dandelion's uncle is a boss of a factory. As the spring festival is coming , he wants to distribute rewards to his workers. Now he has a trouble about how to distribute the rewards.The workers will c...原创 2018-07-18 23:04:41 · 100 阅读 · 0 评论 -
hdu 4857 逃生(拓扑排序)
糟糕的事情发生啦,现在大家都忙着逃命。但是逃命的通道很窄,大家只能排成一行。现在有n个人,从1标号到n。同时有一些奇怪的约束条件,每个都形如:a必须在b之前。同时,社会是不平等的,这些人有的穷有的富。1号最富,2号第二富,以此类推。有钱人就贿赂负责人,所以他们有一些好处。负责人现在可以安排大家排队的顺序,由于收了好处,所以他要让1号尽量靠前,如果此时还有多种情况,就再让2号尽量靠前,如果还有...原创 2018-07-19 08:59:14 · 124 阅读 · 0 评论 -
hdu2444—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 other....原创 2018-07-24 15:28:27 · 89 阅读 · 0 评论 -
POJ1469——Courses (二分图匹配)
Consider a group of N students and P courses. Each student visits zero, one or more than one courses. Your task is to determine whether it is possible to form a committee of exactly P students that sa...原创 2018-07-24 15:31:38 · 111 阅读 · 0 评论 -
FZU 2254 英语考试(最小生成树)
在过三个礼拜,YellowStar有一场专业英语考试,因此它必须着手开始复习。这天,YellowStar准备了n个需要背的单词,每个单词的长度均为m。YellowSatr准备采用联想记忆法来背诵这n个单词:1、如果YellowStar凭空背下一个新词T,需要消耗单词长度m的精力2、如果YellowSatr之前已经背诵了一些单词,它可以选择其中一个单词Si,然后通过联想记忆的方法去背...原创 2018-07-19 16:25:55 · 131 阅读 · 0 评论 -
CodeForces - 731C Socks(并查集)
Arseniy is already grown-up and independent. His mother decided to leave him alone for m days and left on a vacation. She have prepared a lot of food, left some money and washed all Arseniy's clothes....原创 2018-07-19 17:50:28 · 341 阅读 · 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 by e...原创 2018-07-28 17:03:55 · 115 阅读 · 0 评论 -
hdu 4685 Prince and Princess (二分图匹配+tarjan)
There are n princes and m princesses. Princess can marry any prince. But prince can only marry the princess they DO love.For all princes,give all the princesses that they love. So, there is a maximum...原创 2018-11-16 11:00:46 · 116 阅读 · 0 评论