
图论-最短路
图论
Stephencurry‘s csdn
这个作者很懒,什么都没留下…
展开
-
差分约束
转载自:http://www.cppblog.com/menjitianya/archive/2015/11/19/212292.html目录 一、引例 1、一类不等式组的解二、最短路 1、Dijkstra 2、图的存储 3、链式前向星 4、Dijkstra + 优先队列 5、Bellman-Ford...转载 2020-03-30 16:42:47 · 448 阅读 · 1 评论 -
Cow and Fields (CodeForces-1307D)(SPFA最短路)
Bessie is out grazing on the farm, which consists ofnnfields connected bymmbidirectional roads. She is currently at field11, and will return to her home at fieldnnat the end of the day.The Co...原创 2020-03-18 10:49:15 · 248 阅读 · 0 评论 -
Frogger (poj 2253)
Frogger (poj 2253)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 dirty and f...原创 2019-04-10 10:16:28 · 506 阅读 · 0 评论 -
Til the Cows Come Home (poj 2387)(单源最短路)
Til the Cows Come Home (poj 2387)Bessie is out in the field and wants to get back to the barn to get as much sleep as possible before Farmer John wakes her for the morning milking. Bessie needs her ...原创 2019-04-09 21:31:25 · 354 阅读 · 0 评论 -
D - 水题D (HDU - 1874 )
D - 水题D (HDU - 1874 )这道题是最短路启蒙题。某省自从实行了很多年的畅通工程计划后,终于修建了很多路。不过路多了也不好,每次要从一个城镇到另一个城镇时,都有许多种道路方案可以选择,而某些方案要比另一些方案行走的距离要短很多。这让行人很困扰。现在,已知起点和终点,请你计算出要从起点到终点,最短需要行走多少距离。Input本题目包含多组数据,请处理到文件结束。...原创 2019-04-09 11:37:54 · 458 阅读 · 0 评论 -
find the safest road (HDU-1596)(最短路)
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...原创 2019-08-21 10:12:57 · 279 阅读 · 0 评论 -
find the longest of the shortest (HDU-1595)(最短路)
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...原创 2019-08-22 10:16:48 · 221 阅读 · 0 评论 -
浪里个浪 (FZU-2261)(spfa最短路+链式前向星建图)
TonyY是一个喜欢到处浪的男人,他的梦想是带着兰兰姐姐浪遍天朝的各个角落,不过在此之前,他需要做好规划。现在他的手上有一份天朝地图,上面有n个城市,m条交通路径,每条交通路径都是单行道。他已经预先规划好了一些点作为旅游的起点和终点,他想选择其中一个起点和一个终点,并找出从起点到终点的一条路线亲身体验浪的过程。但是他时间有限,所以想选择耗时最小的,你能告诉他最小的耗时是多少吗?Input...原创 2019-08-22 17:26:33 · 166 阅读 · 0 评论 -
Slim Span(POJ-3522)
Given an undirected weighted graphG, you should find one of spanning trees specified as follows.The graphGis an ordered pair (V,E), whereVis a set of vertices {v1,v2, …,vn} andEis a set of...原创 2019-09-07 16:38:04 · 164 阅读 · 0 评论 -
Silver Cow Party (POJ - 3268 )
Silver Cow Party (POJ - 3268 )这道题是我做的最短路专题里的一道题,但我还没做这个,结果比赛就出了,真是。。。。。。。。。。题目:One cow from each ofNfarms (1 ≤N≤ 1000) conveniently numbered 1..Nis going to attend the big cow party to be h...原创 2019-04-10 20:29:19 · 567 阅读 · 0 评论 -
HDU Today (HDU - 2112 )
HDU Today (HDU - 2112 )经过锦囊相助,海东集团终于度过了危机,从此,HDU的发展就一直顺风顺水,到了2050年,集团已经相当规模了,据说进入了钱江肉丝经济开发区500强。这时候,XHD夫妇也退居了二线,并在风景秀美的诸暨市浬浦镇陶姚村买了个房子,开始安度晚年了。这样住了一段时间,徐总对当地的交通还是不太了解。有时很郁闷,想去一个地方又不知道应该乘什么公交车,在什么地方...原创 2019-04-12 19:43:33 · 224 阅读 · 0 评论 -
MPI Maelstrom (POJ-1502)
MPI Maelstrom (POJ-1502)BIT has recently taken delivery of their new supercomputer, a 32 processor Apollo Odyssey distributed shared memory machine with a hierarchical communication subsystem. Valen...原创 2019-04-19 17:09:20 · 414 阅读 · 0 评论 -
Cow Contest (POJ-3660)
Cow Contest (POJ-3660)N(1 ≤N≤ 100) cows, conveniently numbered 1..N, are participating in a programming contest. As we all know, some cows code better than others. Each cow has a certain constant...原创 2019-04-19 11:09:01 · 351 阅读 · 0 评论 -
Invitation Cards (POJ-1511)
Invitation Cards (POJ-1511)In the age of television, not many people attend theater performances. Antique Comedians of Malidinesia are aware of this fact. They want to propagate theater and, most of...原创 2019-04-18 21:04:14 · 530 阅读 · 0 评论 -
SPFA算法
SPFA算法是一种求单源最短路的算法算法中需要用到的主要变量int n; //表示n个点,从1到n标号int s,t; //s为源点,t为终点int d[N]; //d[i]表示源点s到点i的最短路int p[N]; //记录路径(或者说记录前驱)queue <int> q; //一个队列,用STL实现,当然可有手打队列,无所谓bool ...转载 2019-04-18 09:00:39 · 316 阅读 · 0 评论 -
Invitation Cards (POJ-2240)
Invitation Cards (POJ-2240)Arbitrage 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 tha...原创 2019-04-17 20:33:19 · 426 阅读 · 0 评论 -
Wormholes (POJ - 3259)
Wormholes (POJ - 3259)While 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 dest...原创 2019-04-16 21:22:15 · 406 阅读 · 0 评论 -
Currency Exchange (POJ-1860)
Currency Exchange (POJ-1860)Several currency exchange points are working in our city. Let us suppose that each point specializes in two particular currencies and performs exchange operations only wi...原创 2019-04-15 11:30:26 · 931 阅读 · 0 评论 -
Heavy Transportation (POJ—1797)
Heavy Transportation (POJ—1797)BackgroundHugo 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 there reall...原创 2019-04-14 18:35:35 · 439 阅读 · 0 评论 -
昂贵的聘礼(POJ-1062)
昂贵的聘礼(POJ-1062)年轻的探险家来到了一个印第安部落里。在那里他和酋长的女儿相爱了,于是便向酋长去求亲。酋长要他用10000个金币作为聘礼才答应把女儿嫁给他。探险家拿不出这么多金币,便请求酋长降低要求。酋长说:"嗯,如果你能够替我弄到大祭司的皮袄,我可以只要8000金币。如果你能够弄来他的水晶球,那么只要5000金币就行了。"探险家就跑到大祭司那里,向他要求皮袄或水晶球,大祭司要他用...原创 2019-04-22 16:25:37 · 547 阅读 · 0 评论