题目大意:给出一张有向图,求点1到点N的最短路,不同的是,对于每一条边,除了源点目标点和花费以外,还有额外点c,若走这条边之前到达过c点,花费会减少到另一个值P。如果最短路不存在,输出impossible。
先用floyd-warshall算法判断连通性,此时忽略额外的c和P。
然后用dijkstra算法,用d[i][S]表示在点i且经过了S集合的点的最短路,将每一个d[i][S]都看...
分类:
编程语言 时间:
2015-03-02 09:33:06
阅读次数:
178
Tree
时间限制:1000 ms | 内存限制:65535 KB
难度:3
描述Little Valentine liked playing with binary trees very much. Her favorite game was constructing randomly looking binary trees with
capital lett...
分类:
其他好文 时间:
2015-03-01 15:48:19
阅读次数:
172
http://acm.hdu.edu.cn/showproblem.php?pid=2586
Problem Description
There are n houses in the village and some bidirectional roads connecting them. Every day peole always like to ask like this ...
分类:
编程语言 时间:
2015-03-01 11:59:18
阅读次数:
710
Indeed there are many different tourist routes from our city to Rome. You are supposed to find your clients the route with the least cost while gainin...
分类:
其他好文 时间:
2015-03-01 10:28:52
阅读次数:
192
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...
分类:
其他好文 时间:
2015-02-27 13:42:44
阅读次数:
167
Problem Description
In 2100, since the sea level rise, most of the cities disappear. Though some survived cities are still connected with others, but most of them become disconnected. The government wants to build some roads to connect all of these cities ...
分类:
编程语言 时间:
2015-02-23 17:57:24
阅读次数:
271
The Head Elder of the tropical island of Lagrishan has a problem. A burst of foreign aid money was spent on extra roads between villages some years ago. But the jungle overtakes roads relentlessly, so the large road network is too expensive to maintain. Th...
分类:
编程语言 时间:
2015-02-23 15:31:52
阅读次数:
212
Problem Description
There are N villages, which are numbered from 1 to N, and you should build some roads such that every two villages can connect to each other. We say two village A and B are connected, if and only if there is a road between A and B, or t...
分类:
编程语言 时间:
2015-02-23 15:31:07
阅读次数:
231
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...
分类:
其他好文 时间:
2015-02-23 14:19:34
阅读次数:
165
链接:click here
题意:
题目大意在相通n个岛屿的所有桥都坏了,要重修,重修每一个桥所用的时间不同,求重修使每个岛屿都间接或直接与其他岛屿相同时所用的的最短时间(只有修完一个桥后才可修下一个桥)。简言之就是求最小生成树。
对于数据,数据输入的第一行n代表岛屿的个数,当为0是结束程序,接着n-1行开始时为这岛屿的编号,用大写字母表示,接着是一个整数m,表示与该岛屿连接的字...
分类:
其他好文 时间:
2015-02-21 21:07:58
阅读次数:
192