문제
Problem 3: Milk Routing [Brian Dean, 2012]
Farmer John's farm has an outdated network of M pipes
The pipe network is described by N junction points
For a path of pipes connecting from the barn to the tank, the latency of the path is the sum of the latencies of the pipes along the path, and the capacity of the path is the minimum of the capacities of the pipes along the path (since this is the "bottleneck" constraining the overall rate at which milk can be pumped through the path). If FJ wants to send a total of X units of milk through a path of pipes with latency L and capacity C, the time this takes is therefore
Given the structure of FJ's pipe network, please help him select a single path from the barn to the storage tank that will allow him to pump X units of milk in a minimum amount of total time.
PROBLEM NAME: mroute
입력
* Line 1: Three space-separated integers: N M X
* Lines 2..1+M: Each line describes a pipe using 4 integers: I J L C. I and J
출력
* Line 1: The minimum amount of time it will take FJ to send milk along a single path, rounded down to the nearest integer.
예제1
3 3 15
1 2 10 3
3 2 10 2
1 3 14 1
27
INPUT DETAILS:
FJ wants to send 15 units of milk through his pipe network. Pipe #1 connects junction point 1 (the barn) to junction point 2, and has a latency of 10 and a capacity of 3. Pipes #2 and #3 are similarly defined.
OUTPUT DETAILS:
The path 1->3 takes 14 + 15/1 = 29 units of time.
The path 1->2->3 takes 20 + 15/2 = 27.5 units of time, and is therefore optimal.