随笔分类 - 图论--最短路
摘要:问题描述 想象你是一个在Warsaw的游客,而且预订了一次乘车旅行,去城镇外看一些令人惊异的景点。这辆公共汽车首先围绕城镇行驶一段时间(一段很长的时间,由于Warsaw是一个大城市),把在各自旅馆的人们带上。接着它就去了那个令人惊异的景点,几个小时后又回到城市中,再一次行驶到每一个旅馆,这一次把乘客
阅读全文
摘要:Telephone Lines Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 7115 Accepted: 2603 Description Farmer John wants to set up a telephone lin
阅读全文
摘要:Wormholes Time Limit: 2000MS Memory Limit: 65536K Total Submissions: 52062 Accepted: 19373 Description While exploring his many farms, Farmer John has
阅读全文
摘要:Silver Cow Party Time Limit: 2000MS Memory Limit: 65536K Total Submissions: 22580 Accepted: 10333 Description One cow from each of N farms (1 ≤ N ≤ 10
阅读全文
摘要:Six Degrees of Cowvin Bacon Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 5766 Accepted: 2712 Description The cows have been making movie
阅读全文
摘要:Cycling Problem Description You want to cycle to a programming contest. The shortest route to the contest might be over the tops of some mountains and
阅读全文
摘要:WuKong Problem Description Liyuan wanted to rewrite the famous book “Journey to the West” (“Xi You Ji” in Chinese pinyin). In the original book, the M
阅读全文
摘要:Travel Problem Description One day, Tom traveled to a country named BGM. BGM is a small country, but there are N (N <= 100) towns in it. Each town pro
阅读全文
摘要:Einbahnstrasse Problem Description Einbahnstra e (German for a one-way street) is a street on which vehicles should only move in one direction. One re
阅读全文
摘要:A Walk Through the Forest Problem Description Jimmy experiences a lot of stress at work these days, especially since his accident made working difficu
阅读全文
摘要:find the safest road Problem Description XX星球有很多城市,每个城市之间有一条或多条飞行通道,但是并不是所有的路都是很安全的,每一条路有一个安全系数s,s是在 0 和 1 间的实数(包括0,1),一条从u 到 v 的通道P 的安全度为Safe(P) = s(
阅读全文
摘要:Here We Go(relians) Again Problem Description The Gorelians are a warlike race that travel the universe conquering new worlds as a form of recreation.
阅读全文
摘要:In Action Problem Description Since 1945, when the first nuclear bomb was exploded by the Manhattan Project team in the US, the number of nuclear weap
阅读全文
摘要:HDU Today Problem Description 经过锦囊相助,海东集团终于度过了危机,从此,HDU的发展就一直顺风顺水,到了2050年,集团已经相当规模了,据说进入了钱江肉丝经济开发区500强。这时候,XHD夫妇也退居了二线,并在风景秀美的诸暨市浬浦镇陶姚村买了个房子,开始安度晚年了。这
阅读全文
摘要:最短路 Problem Description 在每年的校赛里,所有进入决赛的同学都会获得一件很漂亮的t-shirt。但是每当我们的工作人员把上百件的衣服从商店运回到赛场的时候,却是非常累的!所以现在他们想要寻找最短的从商店到赛场的路线,你可以帮助他们吗? Input 输入包括多组数据。每组数据第一
阅读全文
摘要:1,2,4是四个定点其他的是距离,从2到4最直接的就是2-4,但是不是最近的,需要舒展一下2-1-4,这样只有8.所以才是最短的。这个过程就是狄克斯特拉算法。下面进入正题: 我们这里定义图的编号为: 1 2 3 4 5 6 7 8 9 图1:初始化的图,其中包含边的权值(耗时)。(这里图是有向图)。
阅读全文