
—图论
文章平均质量分 88
MissZhou要努力
不晓日月,不辩兰艾,终日碌碌,安与燕雀相随乎
展开
-
HDU 2063 过山车 匈牙利二分图最大匹配
DescriptionRPG girls今天和大家一起去游乐场玩,终于可以坐上梦寐以求的过山车了。可是,过山车的每一排只有两个座位,而且还有条不成文的规矩,就是每个女生必须找个个男生做partner和她同坐。但是,每个女孩都有各自的想法,举个例子把,Rabbit只愿意和XHD或PQK做partner,Grass只愿意和linle或LL做partner,PrincessSnow愿意和水域浪子原创 2015-08-23 23:02:57 · 433 阅读 · 0 评论 -
HDU 4109 Instrction Arrangement拓扑排序 关键路径模板
题目!已知其中几对先后顺序及时间差,求整体完成时间 套模板吧#include #include#includeusing namespace std;const int N=1005;int indeg[N],finish[N],n,m;struct node{ int v,cost; struct node *next; node(){原创 2015-08-20 16:51:50 · 656 阅读 · 0 评论 -
hdu1532Drainage Ditches裸的网络流
Problem DescriptionEvery time it rains on Farmer John's fields, a pond forms over Bessie's favorite clover patch. This means that the clover is covered by water for awhile and takes quite a long t原创 2015-08-21 22:19:41 · 369 阅读 · 0 评论 -
zoj1508Intervals&poj1201 Intervals【差分约束论文题】
You are given n closed, integer intervals [ai, bi] and n integers c1, ..., cn.Write a program that:> reads the number of intervals, their endpoints and integers c1, ..., cn from the standard i原创 2016-03-02 13:06:01 · 578 阅读 · 0 评论 -
图论汇总
开学开始刷~最短路问题此类问题类型不多,变形较少POJ 2449 Remmarguts' Date(中等)http://acm.pku.edu.cn/JudgeOnline/problem?id=2449题意:经典问题:K短路解法:dijkstra+A*(rec),方法很多相关:http://acm.pku.edu.cn/JudgeOnline/showco转载 2016-02-03 11:31:06 · 2596 阅读 · 0 评论 -
hdu4292Food【拆点网络流】
Description You, a part-time dining service worker in your college’s dining hall, are now confused with a new problem: serve as many people as possible. The issue comes up as people in your原创 2016-04-05 07:29:55 · 637 阅读 · 0 评论 -
HDU 3829 - Cat VS Dog【二分图最大匹配最大独立集】
SubmitStatusDescriptionThe 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, th原创 2016-03-12 15:01:39 · 409 阅读 · 0 评论 -
hdu4411Arrest【最小费用最大流 拆点】
StatusDescriptionThere are (N+1) cities on TAT island. City 0 is where police headquarter located. The economy of other cities numbered from 1 to N ruined these years because they are all co原创 2016-04-12 22:08:12 · 584 阅读 · 0 评论 -
hdu4975A simple Gaussian elimination problem.【网络流判断是否解唯一】
选择这个是个错误QAQ题意:给定一个n*m的棋盘,给出每行的和以及每列的和,问是否可以确定出该棋盘(唯一,多解or无解)很容易想到建边的方式,然后兴致冲冲的写了,没有想到的是居然还要判唯一!这时候需要理解一下模板的原创 2016-04-07 19:33:59 · 780 阅读 · 0 评论 -
HDU 4289Control【最大流已知点权拆点】
Description You, the head of Department of Security, recently received a top-secret information that a group of terrorists is planning to transport some WMD1 from one city (the source) to anoth原创 2016-04-07 19:48:21 · 545 阅读 · 0 评论 -
nefu495最长k可重区间集问题【最大权不相交路径】网络流24题
本来是应该昨天晚上就写完的,果然在家的状态不好==而且以后就应该11点半之前就睡,脑子不灵光写字都不过脑子还不如睡觉~。~据说今年国赛有5站,留下来问题应该不大,但是能拿什么奖就不好说了,总之要加油。。方法二没看懂,最大权不相交路径太难了,24题里面只有两个,还都是4星的==【问题分析】最大权不相交路径问题,可以用最大费用最大流解决。【建模方法】方法1按左端点排原创 2016-01-18 07:51:20 · 1279 阅读 · 0 评论 -
nefu482方格取数【最大点权独立集】网络流24题
自己吭叽了两个小时终于在测试数据以及标程的引领下A 掉了这个三星的题,白天看了一上午胡波涛的论文总算想起来点了,图论总是比数据结构有爱一些。无奈自己总犯如此二的错误==1、s、t不可能连着所有点啊,想啥呢??既然是二分图就要一边连一半啊 2、连相邻边的时候只连单程的 3、那个flag变量怎么可能换行一定变啊,果然是半夜脑子不灵光了【问题分析】二分图点权最大独立集,转化为最小割模原创 2016-01-17 00:10:01 · 668 阅读 · 0 评论 -
nefu487最长递增子序列问题【网络流24题】超详细讲解+模板
description给定正整数序列x1 , ... , xn 。(1)计算其最长递增子序列的长度s。(2)计算从给定的序列中最多可取出多少个长度为s的递增子序列。(3)如果允许在取出的序列中多次使用x1和xn,则从给定序列中最多可取出多少个长度为s的递增子序列。设计有效算法完成(1)(2)(3)提出的计算任务。input原创 2015-09-26 21:12:22 · 904 阅读 · 0 评论 -
nefu494深海机器人问题【网络流24题】最大费用流
description 深海资源考察探险队的潜艇将到达深海的海底进行科学考察。潜艇内有多个深海机器人。潜艇到达深海海底后,深海机器人将离开潜艇向预定目标移动。深海机器人在移动中还必须沿途采集海底生物标本。沿途生物标本由最先遇到它的深海机器人完成采集。每条预定路径上的生物标本的价值是已知的,而且生物标本只能被采集一次。本题限定深海机器人只能从其出发位置沿着向北或向东的方原创 2015-09-19 10:29:31 · 1002 阅读 · 0 评论 -
nefu488餐巾计划问题【网络流24题】最小费用流
description 一个餐厅在相继的N 天里,每天需用的餐巾数不尽相同。假设第i天需要ri块餐巾(i=1,2,…,N)。餐厅可以购买新的餐巾,每块餐巾的费用为p分;或者把旧餐巾送到快洗部,洗一块需m天,其费用为f 分;或者送到慢洗部,洗一块需n 天(n > m),其费用为s < f 分。每天结束时,餐厅必须决定将多少块脏的餐巾送到快洗部,多少块餐巾送到原创 2015-09-19 08:22:19 · 1063 阅读 · 0 评论 -
最大权闭合图 hdu 3879 Base Station 有模板!
Description新的技术正冲击着手机通讯市场,对于各大运营商来说,这既是机遇,更是挑战。THU集团旗下的CS&T通讯公司在新一代通讯技术血战的前夜,需要做太多的准备工作,仅就站址选择一项,就需要完成前期市场研究、站址勘测、最优化等项目。在前期市场调查和站址勘测之后,公司得到了一共N个可以作为通讯信号中转站的地址,而由于这些地址的地理位置差异,在不同的地方建造通讯中转站需要投入的成原创 2015-08-23 22:29:25 · 638 阅读 · 0 评论 -
URAL1277Cops and Thieves Dinic最大流
DescriptionThe Galaxy Police (Galaxpol) found out that a notorious gang of thieves has plans for stealing an extremely valuable exhibit from the Earth Planetary Museum — an ancient microprocesso原创 2015-08-23 22:22:10 · 870 阅读 · 0 评论 -
Power Network 网络流入门题)
这个题 一看到字符串处理我就烦啊烦== 在小伙伴的帮助下可算是知道怎么改对了 万恶的格式(你怎么不说自己学的不好-->_-->)DescriptionA power network consists of nodes (power stations, consumers and dispatchers) connected by power transport line原创 2015-08-21 22:24:53 · 931 阅读 · 0 评论 -
hdu5294Tricks Device【最短路+网络流】
DescriptionInnocent Wu follows Dumb Zhang into a ancient tomb. Innocent Wu’s at the entrance of the tomb while Dumb Zhang’s at the end of it. The tomb is made up of many chambers, the total number原创 2016-04-05 16:37:30 · 829 阅读 · 0 评论 -
hdu4786Fibonacci Tree【kruskal最小生成树】
Description Coach Pang is interested in Fibonacci numbers while Uncle Yang wants him to do some research on Spanning Tree. So Coach Pang decides to solve the following problem: Consider a bi原创 2016-04-02 09:58:23 · 727 阅读 · 0 评论 -
uva11478 Halum【二分+差分约束】
You are given a directed graph G(V,E) with a set of vertices and edges. Each edge (i,j) that connects some vertex i to vertex j has an integer cost associated with that edge. Define the operation原创 2016-04-02 09:20:34 · 654 阅读 · 0 评论 -
uva11090Going in Cycle!!【bellman二分判负环】
Problem G: Going in Cycle!!Input: standard inputOutput: standard output You are given a weighted directed graph with n vertices and m edges. Each cycle in the graph has原创 2016-03-29 16:46:51 · 399 阅读 · 0 评论 -
Aizu 2249Road Construction 单源最短路变形 spfa模板改写
DescriptionKing Mercer is the king of ACM kingdom. There are one capital and some cities in his kingdom. Amazingly, there are no roads in the kingdom now. Recently, he planned to construct roads b原创 2016-03-28 21:05:19 · 1129 阅读 · 0 评论 -
hdu5137How Many Maos Does the Guanxi Worth【最短路最大值】
Problem Description"Guanxi" is a very important word in Chinese. It kind of means "relationship" or "contact". Guanxi can be based on friendship, but also can be built on money. So Chinese often say原创 2016-03-22 09:32:03 · 1048 阅读 · 0 评论 -
hdu3440House Man【差分约束系统】
Problem DescriptionIn Fuzhou, there is a crazy super man. He can’t fly, but he could jump from housetop to housetop. Today he plans to use N houses to hone his house hopping skills. He will start at原创 2016-03-03 11:06:04 · 1319 阅读 · 0 评论 -
hdu1531King【差分约束系统】
Problem DescriptionOnce, in one kingdom, there was a queen and that queen was expecting a baby. The queen prayed: ``If my child was a son and if only he was a sound king.'' After nine months her chi原创 2016-03-02 23:09:29 · 1135 阅读 · 0 评论 -
zoj1420Cashier Employment【差分约束系统论文题】
A supermarket in Tehran is open 24 hours a day every day and needs a number of cashiers to fit its need. The supermarket manager has hired you to help him, solve his problem. The problem is that the s原创 2016-03-02 16:26:38 · 1477 阅读 · 2 评论 -
POJ 3159 Candies差分约束系统 spfa 附:各种最短路比较
DescriptionDuring the kindergarten days, flymouse was the monitor of his class. Occasionally the head-teacher brought the kids of flymouse’s class a large bag of candies and had flymouse distr原创 2015-08-21 18:54:06 · 717 阅读 · 1 评论 -
POJ 1860 Currency Exchange spfa
DescriptionSeveral currency exchange points are working in our city. Let us suppose that each point specializes in two particular currencies and performs exchange operations only with these curren原创 2015-08-21 16:38:55 · 586 阅读 · 0 评论 -
POJ 2240 Arbitrage floyd
DescriptionArbitrage is the use of discrepancies in currency exchange rates to transform one unit of a currency into more than one unit of the same currency. For example, suppose that 1 US Dollar原创 2015-08-21 16:35:10 · 522 阅读 · 0 评论 -
POJ 3268 Silver Cow Party
DescriptionOne cow from each of N farms (1 ≤ N ≤ 1000) conveniently numbered 1..N is going to attend the big cow party to be held at farm #X (1 ≤ X ≤ N). A total of M (1 ≤ M ≤ 100,000) unidirect原创 2015-08-21 16:30:00 · 514 阅读 · 0 评论 -
hdu1599 find the mincost route
Problem Description杭州有N个景区,景区之间有一些双向的路来连接,现在8600想找一条旅游路线,这个路线从A点出发并且最后回到A点,假设经过的路线为V1,V2,....VK,V1,那么必须满足K>2,就是说至除了出发点以外至少要经过2个其他不同的景区,而且不能重复经过同一个景区。现在8600需要你帮他找一条这样的路线,并且花费越少越好。 Input原创 2015-08-20 19:30:11 · 524 阅读 · 0 评论 -
poj1734Sightseeing trip floyd最小环
就是裸的最小环 链接DescriptionThere is a travel agency in Adelton town on Zanzibar island. It has decided to offer its clients, besides many other attractions, sightseeing the town. To earn as much原创 2015-08-20 19:26:22 · 932 阅读 · 1 评论 -
hdu2680Choose the best route dijkstra
开始呢这个题一看是多个点对点的,想用弗洛伊德做,超时,搜了题解 dijkstra 可以处理多点对一点的 还是没有好好理解dijkstra第一步初始化的作用,第一步从哪个点初始化,就是从哪个点出发==还得是潜下心debug啊~~而且dijkstra中每一步都是最优,完全可以处理多点对一点的问题Problem DescriptionOne day , Kiki wants to visit原创 2015-06-22 14:55:14 · 543 阅读 · 0 评论 -
hdu1596find the safest road最短路floyd
其实就是模板的加法变成了乘法==但是注意“0”的处理!!看了标程才发现(⊙﹏⊙)b eps涉及double就记得用吧Problem DescriptionXX星球有很多城市,每个城市之间有一条或多条飞行通道,但是并不是所有的路都是很安全的,每一条路有一个安全系数s,s是在 0 和 1 间的实数(包括0,1),一条从u 到 v 的通道P 的安全度为Safe(P) = s(e1)*s(e2原创 2015-06-16 23:18:53 · 627 阅读 · 0 评论 -
hdu1162Eddy's picture 最小生成树
╮(╯_╰)╭模板是距离已知 这个多算个欧式距离Problem DescriptionEddy begins to like painting pictures recently ,he is sure of himself to become a painter.Every day Eddy draws pictures in his原创 2015-06-16 23:01:32 · 608 阅读 · 0 评论 -
HDU 4337 King Arthur's Knights 【哈密顿模板题】
DescriptionI am the bone of my sword. Steel is my body, and the fire is my blood.- from Fate / Stay Night You must have known the legend of King Arthur and his knights of the round table. Th原创 2016-04-03 17:56:58 · 508 阅读 · 0 评论 -
poj2438 Children's Dining【哈密顿图模板题】
DescriptionUsually children in kindergarten like to quarrel with each other. This situation annoys the child-care women. For instant, when diner time comes, a fierce conflict may break out when a原创 2016-03-19 15:25:23 · 666 阅读 · 0 评论 -
UVALive 4255 Guess【拓扑排序 】
题目转不过来:点击打开链接这个题真是万万没想到是拓扑排序啊啊啊,以为和之前有一个变换质数的题一样是深搜==挑了半天没看出来哪里错了⊙﹏⊙b汗先说拓扑排序是什么来着,这也是扔了几乎半年的知识点==,通过找连着的边,让点的入度减少,入度为0的点入队列,从而形成一条可行路径==这题是白书训练指南310页的例题,“连续和转化为前缀之和”这个性质我想到了,但是没想到正负号就可以确定前后两个前缀和从而在拓原创 2016-03-15 21:39:34 · 508 阅读 · 0 评论 -
HDU 3836 - Equivalent Sets【强连通分量 基础题】
DescriptionTo prove two sets A and B are equivalent, we can first prove A is a subset of B, and then prove B is a subset of A, so finally we got that these two sets are equivalent.You are to p原创 2016-03-12 14:52:34 · 659 阅读 · 0 评论