最短路
文章平均质量分 54
鶸鶸
这个作者很懒,什么都没留下…
展开
-
HDU2923 Einbahnstrasse (最短路 floyd)
上题:Einbahnstra e (German for a one-way street) is a street on which vehicles should only move in one direction. One reason for having one-way streets is to facilitate a smoother flow of traffic t原创 2017-04-09 23:10:25 · 212 阅读 · 0 评论 -
POJ - 1201 Intervals
题意:给你一组区间a和b ,你在这里最少选择c个点,问你最少选择多少个点可以满足条件。思路:在刚开始着手这道题的时候是不是一点思路都没有,嗯,在仔细想想你会发现你还是没思路。。。对,正解思路是差分约束,我们先假设dis[i]表示的是从0到i中可以选择的点,那么从区间a到b至少选择c个点转化一下就是dis[b+1] - dis[a] >= c之后我们换一下位置就是 dis[b+1] >=...原创 2018-04-13 20:07:15 · 79 阅读 · 0 评论 -
CodeForces - 954D Fight Against Traffic (最短路)
题意:哇,我这个题翻译了最少1个小时,到死都没翻译出来。。。题意就是:给你n个点和m条边,之后给你一个起点和终点,其中一个点(A)到另一个点(B)的距离定义为A到B经过了多少条路径,现在问你的是,在原图中最多可以加多少条边使得起点到终点的最短路不变。思路:我们明确一下题意,其实就是在第i点和第j点加一条边,使得s点到t点的最短距离不变,其中我们知道i到j的边权是1那么其实就是 dis[起点][i]...原创 2018-04-05 17:43:59 · 210 阅读 · 0 评论 -
poj 1062 昂贵的聘礼
题目大意是说有N个物品,每个物品都有自己的价格,但同时某些物品也可以由其他的(可能不止一个)替代品,这些替代品的价格比较“优惠”,问怎么样选取可以让你的花费最少来购买到物品1思路: 每个点都有一个权值,之后让你怎样经过一系列操作让第一个物品的权值最小,我们可以设一个0号节点,来存0-i这条路的权值,表示从0号物品到第i号物品的价值是v,之后i号物品可以交换的物品p的价值就是存p-i的这条路的权原创 2018-01-30 21:25:53 · 231 阅读 · 0 评论 -
[Vijos 2024]无向图最短路径 (最短路)
https://vijos.org/p/2024题意: 给你图中每两个点的最短路,问你可不可以增加一条边的权值,使最小值不受影响,让这个最大值最大。思路:一个图已经给定了,怎样才能增加一个边的权值使他最小值不受影响呢,应该可以想到就是当一个点可以被松弛的时候 我们可以吧边权增加到无限大,但是已经使最短路了,怎么能松弛呢? 那就是相等时候啊 ,那就是:if(a[i][j]==a[原创 2017-10-20 19:57:13 · 1986 阅读 · 0 评论 -
poj 1797 Heavy Transportation
上题: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 there really is a way from the place原创 2017-04-27 21:41:01 · 183 阅读 · 0 评论 -
poj 2387 Til the Cows Come Home (最短路)
上题: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 beauty sleep, so she wants原创 2017-04-27 21:39:03 · 126 阅读 · 0 评论 -
HDU5137 How Many Maos Does the Guanxi Worth
上题: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 "I don't have原创 2017-04-27 21:34:20 · 185 阅读 · 0 评论 -
hdu 5137 How Many Maos Does the Guanxi Worth(最短路)
上题:"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 "I don't have o原创 2017-04-27 21:22:06 · 197 阅读 · 0 评论 -
HDU - 4725 The Shortest Path in Nya Graph(最短路)好题好题
上题:This is a very easy problem, your task is just calculate el camino mas corto en un grafico, and just solo hay que cambiar un poco el algoritmo. If you do not understand a word of this paragra原创 2017-05-06 11:13:08 · 467 阅读 · 0 评论 -
51nod 1459 迷宫游戏(最短路)
上题:你来到一个迷宫前。该迷宫由若干个房间组成,每个房间都有一个得分,第一次进入这个房间,你就可以得到这个分数。还有若干双向道路连结这些房间,你沿着这些道路从一个房间走到另外一个房间需要一些时间。游戏规定了你的起点和终点房间,你首要目标是从起点尽快到达终点,在满足首要目标的前提下,使得你的得分总和尽可能大。现在问题来了,给定房间、道路、分数、起点和终点等全部信息,你能计算在尽快离开迷宫的前提下原创 2017-05-11 01:11:47 · 211 阅读 · 0 评论 -
POJ - 1502 MPI Maelstrom(最短路)
上题:BIT has recently taken delivery of their new supercomputer, a 32 processor Apollo Odyssey distributed shared memory machine with a hierarchical communication subsystem. Valentine McKee's rese原创 2017-04-30 20:38:09 · 186 阅读 · 0 评论 -
POJ - 1860 Currency Exchange(最短路)
上题: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 with these currencies.原创 2017-04-30 20:20:26 · 244 阅读 · 0 评论 -
poj 3268 Silver Cow Party
上题: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 ≤ 100,000) unidirectiona原创 2017-04-27 21:47:09 · 209 阅读 · 0 评论 -
Educational Codeforces Round 54 (Rated for Div. 2) D Edge Deletion (最短路)
题意:给你一个无向图,之后又n个点m条边,现在让你将整个图删成只剩下k条边,并且保证删除后的边的最短路不变,现在问你剩下的边的编号是多少思路:删除的边要保证最短路不变,那么就可以看出,松弛的边是一定不能删除的,因为删除他之后我们的最短路肯定会改变的,那么我们将松弛的边全部找出来,取完之后我们会发现每一个前驱只可能有一个后继,那么这其实就是一棵树了,之后我们从树的根节点里选出k个点就好了。代...原创 2018-11-13 22:00:13 · 137 阅读 · 0 评论