
最短路
饮酒在风里
这个作者很懒,什么都没留下…
展开
-
新年好(最短路+dfs)
重庆城里有nn个车站,mm条双向公路连接其中的某些车站。每两个车站最多用一条公路连接,从任何一个车站出发都可以经过一条或者多条公路到达其他车站,但不同的路径需要花费的时间可能不同。在一条路径上花费的时间等于路径上所有公路需要的时间之和。佳佳的家在车站11,他有五个亲戚,分别住在车站a,b,c,d,ea,b,c,d,e。过年了,他需要从自己的家出发,拜访每个亲戚(顺序任...原创 2019-12-04 19:34:57 · 571 阅读 · 0 评论 -
二分+最短路-spfa(洛谷-P1462 通往奥格瑞玛的道路)
题目背景在艾泽拉斯大陆上有一位名叫歪嘴哦的神奇术士,他是部落的中坚力量有一天他醒来后发现自己居然到了联盟的主城暴风城在被众多联盟的士兵攻击后,他决定逃回自己的家乡奥格瑞玛题目描述在艾泽拉斯,有n个城市。编号为1,2,3,...,n。城市之间有m条双向的公路,连接着两个城市,从某个城市到另一个城市,会遭到联盟的攻击,进而损失一定的血量。每次经过一个城市,都会被收取一定的过...原创 2019-10-16 16:08:35 · 208 阅读 · 0 评论 -
最优贸易(spfa)
C国有 n 个大城市和 m 条道路,每条道路连接这 n 个城市中的某两个城市。任意两个城市之间最多只有一条道路直接相连。这 m 条道路中有一部分为单向通行的道路,一部分为双向通行的道路,双向通行的道路在统计条数时也计为1条。C国幅员辽阔,各地的资源分布情况各不相同,这就导致了同一种商品在不同城市的价格不一定相同。但是,同一种商品在同一个城市的买入价和卖出价始终是相同的。商人阿龙...原创 2019-10-02 13:00:31 · 175 阅读 · 0 评论 -
最短路djikstra队列优化
题目链接:#include <iostream>#include <cstring>#include <cstdio>#include <queue>#include <cmath>using namespace std;#define mem(f, x) memset(f,x,sizeof(f))#defin...原创 2019-09-06 19:55:19 · 180 阅读 · 0 评论 -
Heavy Transportation POJ - 1797 (djikstra 变形求最大分路)
C - Heavy TransportationPOJ - 1797BackgroundHugo 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 ther...原创 2019-09-02 14:09:34 · 113 阅读 · 0 评论 -
POJ 3268 Silver Cow Party (dijkstra+矩阵转置)
One cow from each ofNfarms (1 ≤N≤ 1000) conveniently numbered 1..Nis going to attend the big cow party to be held at farm #X(1 ≤X≤N). A total ofM(1 ≤M≤ 100,000) unidirectional (one-way roa...原创 2019-07-09 19:41:09 · 224 阅读 · 0 评论 -
POJ 1797 Heavy Transportation
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 really is a way from the place his cus...原创 2019-07-09 19:07:58 · 130 阅读 · 0 评论 -
POJ 2253 Frogger (最短路:floyd+迪杰斯特拉解法)
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 full of tourists' sun...原创 2019-07-09 16:12:09 · 268 阅读 · 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 to get b...原创 2019-07-09 14:48:24 · 173 阅读 · 0 评论 -
HDU-2680 Choose the best route
Choose the best routeTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 22019Accepted Submission(s): 7036Problem DescriptionOne day , ...原创 2019-07-09 12:33:36 · 211 阅读 · 0 评论 -
HDU 1548 A strange lift (最短路-迪杰斯特拉dijkstra)
Problem DescriptionThere is a strange lift.The lift can stop can at every floor as you want, and there is a number Ki(0 <= Ki <= N) on every floor.The lift have just two buttons: up and down.W...原创 2019-07-09 09:45:56 · 171 阅读 · 0 评论 -
hdu 2112 HDU Today 最短路(floyd+map)
HDU TodayTime Limit: 15000/5000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 43168Accepted Submission(s): 10295Problem Description经过锦囊相助,海东集团终于度过了危机,从...原创 2019-07-08 20:10:22 · 234 阅读 · 0 评论 -
HDU 2066 一个人的旅行 (floyd+剪枝)
一个人的旅行Time Limit: 1000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 58528Accepted Submission(s): 19454Problem Description虽然草儿是个路痴(就是在杭电待了一年多,居然还会...原创 2019-07-08 18:31:17 · 221 阅读 · 0 评论 -
HDU 1874 畅通工程续(Floyd)
畅通工程续Time Limit: 3000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 80190Accepted Submission(s): 30820Problem Description某省自从实行了很多年的畅通工程计划后,终于修建了很...原创 2019-07-08 10:51:16 · 126 阅读 · 0 评论 -
hdu2544 最短路
在每年的校赛里,所有进入决赛的同学都会获得一件很漂亮的t-shirt。但是每当我们的工作人员把上百件的衣服从商店运回到赛场的时候,却是非常累的!所以现在他们想要寻找最短的从商店到赛场的路线,你可以帮助他们吗?Input输入包括多组数据。每组数据第一行是两个整数N、M(N<=100,M<=10000),N表示成都的大街上有几个路口,标号为1的路口是商店所在地,标号为N的路口...原创 2019-07-08 09:39:21 · 114 阅读 · 0 评论 -
Dijkstra算法——团体程序设计天梯赛L2-001 紧急救援 (25 分)
#include <iostream>#include <algorithm>#include <cstring>#include <cmath>using namespace std;const int INF=0x3f3f3f3f;int dis[502],num[502],vis[502],f[502],num1[502],p...原创 2019-02-11 22:30:51 · 543 阅读 · 0 评论