![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
图论
文章平均质量分 72
SPZn_up
这个作者很懒,什么都没留下…
展开
-
uva 10034 Freckles(最小生成树Kruskal)
uva 10034 FrecklesFreckles In an episode of the Dick Van Dyke show, little Richie connects the freckles(雀斑) on his Dad’s back to form a picture of the Liberty Bell. Alas, one of the freckles turns out原创 2015-06-06 19:28:18 · 512 阅读 · 0 评论 -
uva 10397 Connect the Campus(最小生成树kruskal)
uva 10397 Connect the Campus题目大意:有n个点,已知它们的坐标,在它们之间已经有了m条边,已知m条边。求连接所有点的最小路径。解题思路:最小生成树kruskal。#include <cstdio>#include <cstring>#include <algorithm>#include <cmath>#include <cstdlib>using namesp原创 2015-06-10 20:22:56 · 453 阅读 · 0 评论 -
poj 2253 Frogger(最小生成树)
poj 2253 FroggerDescription Freddy Frog is sitting on a stone in the middle of a lake. Suddenly he notices Fiona Frog who is sitting on another stone. He plans to visit her, but since the water is dir原创 2015-07-25 14:32:52 · 4076 阅读 · 2 评论 -
poj 3268 Silver Cow Party(最短路)
poj 3268 Silver Cow PartyDescription One 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原创 2015-07-25 18:54:02 · 1501 阅读 · 0 评论 -
uva 558 Wormholes (Bellman-Ford算法判断负环)
uva 558 WormholesIn the year 2163, wormholes were discovered. A wormhole is a subspace tunnel through space and time connecting two star systems. Wormholes have a few peculiar properties:Wormholes are原创 2015-07-12 16:11:54 · 1004 阅读 · 0 评论 -
uva 10801 Lift Hopping(dijkstra)
uva 10801 Lift HoppingTed the bellhop: "I'm coming up and if there isn'ta dead body by the time I get there, I'll make onemyself. You!"Robert Rodriguez, "Four Rooms."原创 2015-06-12 19:49:05 · 502 阅读 · 0 评论 -
poj 1502 MPI Maelstrom(最短路)
poj 1502 MPI MaelstromDescription BIT has recently taken delivery of their new supercomputer, a 32 processor Apollo Odyssey distributed shared memory machine with a hierarchical communication subsyste原创 2015-07-26 15:13:05 · 1284 阅读 · 0 评论 -
poj 1860 Currency Exchange(Bellman-Ford 改)
poj 1860 Currency ExchangeDescription Several currency exchange points are working in our city. Let us suppose that each point specializes in two particular currencies and performs exchange operations原创 2015-07-26 09:55:46 · 525 阅读 · 0 评论 -
uva 11045 My T-shirt suits me (二分图匹配 最大流)
uva 11045 My T-shirt suits me题目大意:有n件衣服(一定是6的倍数,六种尺码n / 6套),m个试穿者,每个试穿者都有两种合适的尺码(尺码一共有六种:XS, S, M, L, XL, XXL)。问是否所有试穿者都能找到合适的衣服。解题思路:设置一个超级源点,连向所有的试穿者,容量为1。把相同的衣服,当成不同的,比如XS型号的衣服有三件,我们则把它分为编号为1, 1 + 6原创 2015-07-25 14:14:36 · 993 阅读 · 0 评论 -
poj 1797 Heavy Transportation(最大生成树)
poj 1797 Heavy TransportationDescription Background Hugo Heavy is happy. After the breakdown of the Cargolifter project he can now expand business. But he needs a clever man who tells him whether the原创 2015-07-25 16:00:55 · 534 阅读 · 0 评论 -
poj 3259 Wormholes(Bellman-Ford)
poj 3259 WormholesDescriptionWhile exploring his many farms, Farmer John has discovered a number of amazing wormholes. A wormhole is very peculiar because it is a one-way path that delivers you to its原创 2015-07-26 14:11:06 · 815 阅读 · 0 评论 -
poj 3281 Dining(最大流)
poj 3281 DiningDescriptionCows are such finicky eaters. Each cow has a preference for certain foods and drinks, and she will consume no others.Farmer John has cooked fabulous meals for his cows, but he原创 2015-07-26 21:06:02 · 1154 阅读 · 0 评论 -
poj 2195 Going Home(最小费最大流)
poj 2195 Going HomeDescription On a grid map there are n little men and n houses. In each unit time, every little man can move one unit step, either horizontally, or vertically, to an adjacent point.原创 2015-07-27 10:39:51 · 818 阅读 · 0 评论 -
网络流 增广路 入门好文章(转)
转自于:因为是初学教程,所以我会尽量避免繁杂的数学公式和证明。也尽量给出了较为完整的代码。本文的目标群体是网络流的初学者,尤其是看了各种NB的教程也没看懂怎么求最大流的小盆友们。本文的目的是,解释基本的网络流模型,最基础的最大流求法,即bfs找增广路法,也就是EK法,全名是Edmond-Karp,其实我倒是觉得记一下算法的全名和来历可以不时的拿出来装一装。 比如说这个,EK算转载 2015-07-14 18:57:05 · 1034 阅读 · 0 评论 -
uva 10330 Power Transmission (最大流 + 拆点)
uva 10330 Power Transmission如果对最大流不熟悉的话可以先去看看这个题目大意:先来讲解一下INPUT。首先读入一个正整数N, 接下来N个数据是N个调节器的容量;然后读入一个正整数M, 接下来M组数据代表的是M条调节器与调解器之间的线路(调节器u, 调节器v, 容量);最后的一组数据先是两个正整数a和b, 接下来的a个数据代表的是初始的调节器,最后的b个数据代表的是终结的调节原创 2015-07-15 10:07:06 · 1225 阅读 · 0 评论 -
uva 10986 Sending email (dijkstra)
uva 10986 Sending email"A new internet watchdog is creating a stir inSpringfield. Mr. X, if that is his real name, hascome up with a sensational scoop."Kent BrockmanThere are n SMTP se原创 2015-07-14 10:19:20 · 1045 阅读 · 0 评论 -
uva 1161 Objective: Berlin (最大流)
uva 1161 Objective: Berlin题目大意:你要从A地到B地去,并且最晚要在lt之前到达。现在给你m个航班信息,信息包括:起始地点,降落地点,载客上限,起飞时间,降落时间。中途转机要花费半小时的时间。问在lt之前,可以从A地到达B地的最多的游客数量。解题思路:以航班为节点进行建图。设置超级源点,连向所有起点为A地的航班,容量为INF;设置超级汇点,使所有降落地点为B点且降落时间在l原创 2015-08-09 08:36:59 · 581 阅读 · 0 评论 -
poj 2516 Minimum Cost(最小费最大流)
poj 2516 Minimum CostDescription Dearboy, a goods victualer, now comes to a big problem, and he needs your help. In his sale area there are N shopkeepers (marked from 1 to N) which stocks goods from h原创 2015-07-28 08:57:14 · 994 阅读 · 0 评论 -
uva 1345 Jamie's Contact Groups (最大流+二分)
uva 1345 Jamie’s Contact GroupsDescriptionJamie 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 lon原创 2015-08-08 11:21:57 · 1849 阅读 · 0 评论 -
CodeForces 567E President and Roads(最短路 + tarjan)
CodeForces 567E President and RoadsDescriptionBerland has n cities, the capital is located in city s, and the historic home town of the President is in city t (s ≠ t). The cities are connected by one-原创 2015-08-07 16:45:29 · 1568 阅读 · 0 评论 -
uva 11624 Fire!(多源BFS)
uva 11624 Fire!题目大意:J在迷宫里工作,有一天迷宫起火了,火源有多处。每过一秒,火源都会向四个方向蔓延,J也会向四个方向移动,问J能不能跑出去,能的话输出他跑出去的最短时间,否则输出“IMPOSSIBLE”解题思路:先进行一次BFS,找出每一点火焰蔓延到该处的最短时间。然后根据这张“火势图”,对J的行进路线进行BFS。注意J在边缘的时候,以及没有火源的时候。#include <cst原创 2015-08-07 20:49:40 · 666 阅读 · 0 评论 -
uva 1324 Bring Them There (最大流)
uva 1324 Bring Them ThereDescriptionBy the year 3141, the human civilization has spread all over the galaxy. The special hypertunnels are used to travel from one star system to another. To use the hype原创 2015-08-19 21:32:59 · 859 阅读 · 0 评论 -
uva 1486 Transportation (费用流+拆边)
uva 1486 TransportationDescriptionThere are N cities, and M directed roads connecting them. Now you want to transport K units of goods from city 1 to city N. There are many robbers on the road, so you原创 2015-08-09 16:55:29 · 720 阅读 · 0 评论 -
ZOJ 3885 The Exchange of Items(费用流)
ZOJ 3885 The Exchange of ItemsDescription Bob lives in an ancient village, where transactions are done by one item exchange with another. Bob is very clever and he knows what items will become more va原创 2015-08-09 20:24:49 · 574 阅读 · 0 评论 -
uva 1212 Duopoly (最小割最大流)
uva 1212 DuopolyDescriptionThe mobile network market in country XYZ used to be dominated by two large corporations, XYZ Telecom and XYZ Mobile. The central government recently has realized that radio f原创 2015-08-09 14:52:06 · 741 阅读 · 0 评论 -
hdu 2255 奔小康赚大钱(KM算法)
hdu 2255 奔小康赚大钱Description 传说在遥远的地方有一个非常富裕的村落,有一天,村长决定进行制度改革:重新分配房子。 这可是一件大事,关系到人民的住房问题啊。村里共有n间房间,刚好有n家老百姓,考虑到每家都要有房住(如果有老百姓没房子住的话,容易引起不安定因素),每家必须分配到一间房子且只能得到一间房子。 另一方面,村长和另外的村领导希望得到最大的效益,这样村里的机构才会有原创 2015-08-24 10:43:19 · 630 阅读 · 0 评论 -
hdu 1385 Minimum Transport Cost(最短路 + 字典序最小路径)
hdu 1385 Minimum Transport CostDescription These are N cities in Spring country. Between each pair of cities there may be one transportation track or none. Now there is some cargo that should be deliv原创 2015-07-29 13:52:30 · 732 阅读 · 0 评论 -
uva 12083 Guardian of Decency (二分图匹配)
uva 12083 Guardian of DecencyDescription Frank N. Stein is a very conservative high-school teacher. He wants to take some of his students on an excursion, but he is afraid that some of them might beco原创 2015-08-22 16:15:30 · 939 阅读 · 0 评论 -
uva 753 A Plug for UNIX (最大流)
uva 753 A Plug for UNIXYou are in charge of setting up the press room for the inaugural meeting of the United Nations Internet eXecutive (UNIX), which has an international mandate to make the free flow原创 2015-07-16 19:16:21 · 922 阅读 · 0 评论 -
hdu 4289 Control (最大流)
hdu 4289 ControlYou, the head of Department of Security, recently received a top-secret information that a group of terrorists is planning to transport some WMD 1 from one city (the source) to another原创 2015-07-16 21:03:01 · 888 阅读 · 0 评论 -
uva 12125 March of the Penguins (最大流)
uva 12125 March of the Penguins题目大意:网格上有n(n<=100n <= 100)片荷叶,初始时第i片荷叶上有ni只企鹅(0<=ni<=100<=ni<=10)。由于承受能力有限,第i片荷叶最多只能承受mi(1<=mi<=2001<=mi<=200)只企鹅从上米娜跳走。一只企鹅最多能跳D(D<=105D<=10^5)单位距离。要求所有企鹅在同一片荷叶上集合。问哪些荷叶原创 2015-08-10 15:40:10 · 887 阅读 · 0 评论 -
hdu 5373 The shortest problem
hdu 5373 The shortest problemProblem Description In this problem, we should solve an interesting game. At first, we have an integer n, then we begin to make some funny change. We sum up every digit of原创 2015-08-11 21:22:02 · 759 阅读 · 0 评论 -
uva 1658 Admiral (最小费最大流)
uva 1658 Admiral题目大意:在图中找出两条没有交集的线路,要求这两条线路的费用最小。解题思路:还是拆点建图的问题。首先每个点都要拆成两个点,例如a点拆成a->a’。起点和终点的两点间的容量为2费用为0,保证了只找出两条线路。其余点的容量为1费用为0,保证每点只走一遍,两条线路无交集。然后根据题目给出的要求继续建图。每组数据读入a, b, c, 建立a’到b的边容量为1, 费用为c。图建原创 2015-07-18 15:26:38 · 807 阅读 · 0 评论 -
hdu 5375 Gray code(DP)
hdu 5375 Gray codeProblem Description The reflected binary code, also known as Gray code after Frank Gray, is a binary numeral system where two successive values differ in only onebit (binary digit).原创 2015-08-11 21:29:49 · 572 阅读 · 0 评论 -
uva 11374 Airport Express(最短路)
uva 11374 Airport ExpressIn a small city called Iokh, a train service, Airport-Express, takes residents to the airport more quickly than other transports. There are two types of trains in Airport-Expre原创 2015-07-30 10:24:53 · 2076 阅读 · 1 评论 -
uva 10917 Walk Through the Forest(最短路)
uva 10917 Walk Through the Forestgbn最近打算穿过一个森林,但是他比较傲娇,于是他决定只走一些特殊的道路,他打算只沿着满足如下条件的(A,B)道路走:存在一条从B出发回家的路,比所有从A出发回家的路径都短。你的任务是计算一共有多少条不同的回家路径。其中起点的编号为1,终点的编号为2. Input多组数据输入,每组数据第一行输入n,m(1<=n<=1000)表示点的原创 2015-08-11 08:48:19 · 1202 阅读 · 0 评论 -
NBUT 1914 asd的甩锅计划(最小生成树)
NBUT 1914 asd的甩锅计划题目描述 大家对hdu上面的畅通工程系列一定很熟悉了吧。比如如下一段,就是畅通工程里面其中一个题的叙述。 某省调查乡村交通状况,得到的统计表中列出了任意两村庄间的距离。省政府“畅通工程”的目标是使全省任何两个村庄间都可以实现公路交通(但不一定有直接的公路相连,只要能间接通过公路可达即可),并要求铺设的公路总长度为最小。请计算最小的公路总长度。原创 2015-07-30 10:31:41 · 807 阅读 · 0 评论 -
hdu 4360 As long as Binbin loves Sangsang(最短路)
hdu 4360 As long as Binbin loves SangsangDescription Binbin misses Sangsang so much. He wants to meet with Sangsang as soon as possible. Now Binbin downloads a map from ELGOOG.There are N (1<=N<=1,3原创 2015-07-31 14:25:00 · 647 阅读 · 0 评论 -
hdu 3081 Marriage Match II (二分+最大流+并查集)
hdu 3081 Marriage Match IIDescription Presumably, you all have known the question of stable marriage match. A girl will choose a boy; it is similar as the game of playing house we used to play when we原创 2015-08-12 18:54:35 · 680 阅读 · 0 评论 -
hdu 4280 Island Transport(最大流)
hdu 4280 Island TransportDescription In the vast waters far far away, there are many islands. People are living on the islands, and all the transport among the islands relies on the ships. You ha原创 2015-07-30 19:18:42 · 1191 阅读 · 0 评论