HBC24612灯谜[USACO 2011 Jan G]Roads and Planes题解 (anewmilkcontractinanewterritory)

为你而来永不停止 算法基础篇 50 0
想要检验自己的编程水平?来试试全网最全C++题库,让您在挑战中不断进步。
Farmer John is conducting research for a new milk contract in a new territory. He intends to distribute milk to T (1

Farmer John is conducting research for a new milk contract in a new territory. He intends to distribute milk to T (1 <= T <= 25,000) towns conveniently numbered 1..T which are connected by up to R (1 <= R <= 50,000) roads conveniently numbered 1..R and/or P (1 <= P <= 50,000) airplane flights conveniently numbered 1..P. Either road i or plane i connects town  A_i A i ​ (1 <= A_i A i ​ <= T) to town B_i B i ​ (1 <= B_i B i ​ <= T) with traversal cost C_i C i ​ . For roads, 0 <= C_i C i ​ <= 10,000; however, due to the strange finances of the airlines, the cost for planes can be quite negative (-10,000 <= C_i C i ​ <= 10,000). Roads are bidirectional and can be traversed from A_i A i ​ to B_i B i ​ or B_i B i ​ to A_i A i ​ for the same cost; the cost of a road must be non-negative. Planes, however, can only be used in the direction from A_i A i ​ to B_i B i ​ specified in the input. In fact, if there is a plane from A_i A i ​ to B_i B i ​ it is guaranteed that there is no way to return from B_i B i ​ to A_i A i ​ with any sequence of roads and planes due to recent antiterror regulation. Farmer John is known around the world as the source of the world's finest dairy cows. He has in fact received orders for his cows from every single town. He therefore wants to find the cheapest price for delivery to each town from his distribution center in town S (1 <= S <= T) or to know that it is not possible if this is the case.

HBC24612灯谜[USACO 2011 Jan G]Roads and Planes题解
(anewmilkcontractinanewterritory)-第1张图片-东莞河马信息技术
(图片来源网络,侵删)
全网最全C++题库,助您挑战自我,突破极限,成为编程领域的佼佼者!

标签: HBC24612灯谜[USACO 2011 Jan G]Roads and Planes题解