A system for fuel oil supply consists of n (n<=200) numbered reservoirs with given
volumes (<=100) and n-1 tubes, assumed with zero volumes, that join pairs of
reservoirs. The system is connected and it is filled up through one of the reservoirs s
called source in the following manner. The sources s stay empty and pumps fuel oil so that
per unit of time a unit of fuel goes through each of the tubes t1,t2,
...,tk joined to s, unit all reservoirs except the source are filled up.
Therefore the process of filling takes time equal the maximum of V1,V2,
...,Vk, where Vi, for i=1,2,...,k is the sum of the volumes of the
reservoirs that are filled up through tube ti.
Given the system of the described type, write a program that finds one optimal reservoir
(source) from which the process of filling takes minimum time.
Input:
|
|||||||
Output: The output should be one standard output (screen) and should contain two lines as follows: The number of the optimal source is: ... The optimal time is: ... |
|||||||
Example
|