문제
Problem 2: Vacation Planning [Kalki Seksaria, 2013]
Air Bovinia is planning to connect the N farms
Currently there are M
The airline recently received a request for Q
PROBLEM NAME: vacation
입력
* Line 1: Four integers: N, M, K, and Q.
* Lines 2..1+M: Line i+1 contains
* Lines 2+M..1+M+Q: Line 1+M+i describes the
출력
* 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.
예제1
33 1 3
3 1 10
1 3 10
1 2 7
3 2
2 3
1 2
2
24
Input Details
There are three farms (numbered
Output Details
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.