来源:http://www.lydsy.com/JudgeOnline/problem.php?id=3889
3889: [Usaco2015 Jan]Cow Routing
Time Limit: 10 Sec Memory Limit: 128 MBSubmit: 37 Solved: 9
[ Submit][ Status]
Description
Tired of the cold winter weather on her farm, Bessie the cow plans to fly to a warmer destination for vacation. Unfortunately, she discovers that only one airline, Air Bovinia, is willing to sell tickets to cows, and that these tickets are somewhat complicated in structure. Air Bovinia owns N planes (1 <= N <= 1000), each of which flies on a specific "route" consisting of two or more cities. For example, one plane might fly on a route that starts at city 1, then flies to city 5, then flies to city 2, and then finally flies to city 8. No city appears multiple times in a route. If Bessie chooses to utilize a route, she can board at any city along the route and then disembark at any city later along the route. She does not need to board at the first city or disembark at the last city. Each route has a certain cost, which Bessie must pay if she uses any part of the route, irrespective of the number of cities she visits along the route. If Bessie uses a route multiple times during her travel (that is, if she leaves the route and later comes back to use it from antoher city), she must pay for it each time it is used. Bessie would like to find the cheapest way to travel from her farm (in city A) to her tropical destination (city B). Please help her decide what is the minimum cost she must pay, and also the smallest number of individual flights she must use take to achieve this minimum cost.
Input
Output
Sample Input
3 5
1 2 3 4 5
2 3
3 5 4
1 2
1 5
Bessie计划使用AirBovinia航空公司的N条航线从城市A前往热带目的地城市B。每条航线包含多个城市,Bessie可在任意城市上、下飞机。任务是找到成本最低且航班数最少的旅行方案。
428

被折叠的 条评论
为什么被折叠?



