P3094 [USACO13DEC] Vacation Planning S
题目描述
有N(1
输入格式
\* Line 1: Four integers: N, M, K, and Q.
\* Lines 2..1+M: Line i+1 contains u\_i, v\_i, and d\_i for flight i.
\* Lines 2+M..1+M+Q: Line 1+M+i describes the ith trip in terms of a\_i and b\_i
输出格式
\* Line 1: The number of trips (out of Q) for which a valid route is possible.
\* Line 2: The sum, over all trips for which a valid route is possible, of the minimum possible route cost.
说明/提示
There are three farms (numbered 1..3); farm 1 is a hub. There is a $10 flight from farm 3 to farm 1, and so on. We wish to look for trips from farm 3 to farm 2, from 2->3, and from 1->2.
The trip from 3->2 has only one possible route, of cost 10+7. The trip from 2->3 has no valid route, since there is no flight leaving farm 2. The trip from 1->2 has only one valid route again, of cost 7.