
最短or最长路径
文章平均质量分 63
vocaloid01
小菜鸟一只_(:з」∠)_前来膜拜各路大佬orz
展开
-
pat 甲级 1003 Emergency (求最短路径条数)
As an emergency rescue team leader of a city, you are given a special map of your country. The map shows several scattered cities connected by some roads. Amount of rescue teams in each city and the l...原创 2019-03-15 20:51:31 · 777 阅读 · 0 评论 -
Made In Heaven(ACM-ICPC 2018 沈阳赛区网络预赛)
1000ms 131072K One day in the jail, F·F invites Jolyne Kujo (JOJO in brief) to play tennis with her. However, Pucci the father somehow knows it and wants to stop her. There are N spots in the jail an...原创 2018-09-08 19:12:13 · 509 阅读 · 0 评论 -
51NOD1445 变色DNA (巧建图+Dijkstra)
有一只特别的狼,它在每个夜晚会进行变色,研究发现它可以变成N种颜色之一,将这些颜色标号为0,1,2...N-1。研究发现这只狼的基因中存在一个变色矩阵,记为colormap,如果colormap[i][j]='Y'则这只狼可以在某一个夜晚从颜色i变成颜色j(一晚不可以变色多次),如果colormap[i][j]=‘N’则不能在一个晚上从i变成j色。进一步研究发现,这只狼每次变色并不是随机变的,它有...原创 2018-09-04 15:28:48 · 175 阅读 · 0 评论 -
CCPC-WannaFly-Camp 1058: New Game!(double最短路)
Time limit: 1 second Memory limit: 1024 megabytes Eagle Jump公司正在开发一款新的游戏。泷本一二三作为其员工,获得了提前试玩的机会。现在她正在 试图通过一个迷宫。 这个迷宫有一些特点。为了方便描述,我们对这个迷宫建立平面直角坐标系。迷宫中有两条平行直线 L1 : Ax + By + C1 = 0, L2 : Ax + By + C2 = ...原创 2018-08-04 16:55:06 · 284 阅读 · 0 评论 -
POJ - 2449 Remmarguts' Date(A*+SPFA求第K短路)
"Good man never makes girls wait or breaks an appointment!" said the mandarin duck father. Softly touching his little ducks' head, he told them a story. "Prince Remmarguts lives in his kingdom UDF – U...原创 2018-07-30 21:50:34 · 235 阅读 · 0 评论 -
POJ - 1860 Currency Exchange (Spfa判断是否有正权环)
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. There can...原创 2018-07-27 18:12:06 · 215 阅读 · 0 评论 -
Dijkstra 模板
#include <iostream> #include <cstdio> #include <cstring> #include <queue> #include <cstdlib>using namespac原创 2017-11-14 17:55:50 · 338 阅读 · 0 评论 -
Floyd算法详解(转)
正如我们所知道的,Floyd算法用于求最短路径。Floyd算法可以说是Warshall算法的扩展,三个for循环就可以解决问题,所以它的时间复杂度为O(n^3)。Floyd算法的基本思想如下:从任意节点A到任意节点B的最短路径不外乎2种可能,1是直接从A到B,2是从A经过若干个节点X到B。所以,我们假设Dis(AB)为节点A到节点B的最短路径的距离,对于每一个节点X,我们检查Dis(AX) + Di转载 2017-10-12 16:32:34 · 740 阅读 · 0 评论 -
find the safest road HDU - 1596
Time limit 5000 ms Memory limit 32768 kB XX星球有很多城市,每个城市之间有一条或多条飞行通道,但是并不是所有的路都是很安全的,每一条路有一个安全系数s,s是在 0 和 1 间的实数(包括0,1),一条从u 到 v 的通道P 的安全度为Safe(P) = s(e1)*s(e2)…*s(ek) e1,e2,ek是P 上的边 ,现在8600原创 2017-09-30 10:11:07 · 200 阅读 · 0 评论 -
51NOD-1459 迷宫游戏(最大费用最短路-SPFA和Dijkstra实现)
你来到一个迷宫前。该迷宫由若干个房间组成,每个房间都有一个得分,第一次进入这个房间,你就可以得到这个分数。 还有若干双向道路连结这些房间,你沿着这些道路从一个房间走到另外一个房间需要一些时间。游戏规定了你的起点和终点房间,你首要目标是从起点尽快到达终点,在满足首要目标的前提下,使得你的得分总和尽可能大。现在问题来了,给定房间、道路、分数、起点和终点等全部信息,你能计算在尽快离开迷宫的前提下,你的最...原创 2017-08-08 17:22:28 · 265 阅读 · 0 评论 -
Jzzhu and Cities ----CodeForces - 449B
Jzzhu is the president of country A. There are n cities numbered from 1 to n in his country. City 1 is the capital of A. Also there are m roads connecting the cities. One can go from city ui to...原创 2017-08-05 16:41:16 · 298 阅读 · 0 评论 -
How Many Maos Does the Guanxi Worth --HDU - 5137
"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 one原创 2017-08-05 14:21:52 · 301 阅读 · 0 评论 -
HDU 2066 一个人的旅行
虽然草儿是个路痴(就是在杭电待了一年多,居然还会在校园里迷路的人,汗~),但是草儿仍然很喜欢旅行,因为在旅途中 会遇见很多人(白马王子,^0^),很多事,还能丰富自己的阅历,还可以看美丽的风景……草儿想去很多地方, 她想要去东京铁塔看夜景,去威尼斯看电影,去阳明山上看海芋,去纽约纯粹看雪景,去巴黎喝咖啡写信, 去北京探望孟姜女……眼看寒假就快到了,这么一大段时间,可不能浪费啊,一定要给自己好好的原创 2017-08-03 10:41:20 · 188 阅读 · 0 评论 -
HDU3790 最短路径问题(双重权值+spfa)
给你n个点,m条无向边,每条边都有长度d和花费p,给你起点s终点t,要求输出起点到终点的最短距离及其花费,如果最短距离有多条路线,则输出花费最少的。 Input: 输入n,m,点的编号是1~n,然后是m行,每行4个数 a,b,d,p,表示a和b之间有一条边,且其长度为d,花费为p。最后一行是两个数 s,t;起点s,终点。n和m为0时输入结束。 (1<n<=1000, 0<...原创 2017-08-02 20:59:49 · 314 阅读 · 0 评论 -
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) unidirectional (one-way ro原创 2017-08-02 15:26:14 · 178 阅读 · 0 评论 -
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原创 2017-08-02 11:38:47 · 205 阅读 · 0 评论