#T259. 排队接水
排队接水
Description
There are people queuing in front of a faucet to fetch water. Suppose the time taken for each person to fetch water is , please write a program to determine an order for these people to queue such that the average waiting time for all people is minimized.
Input Format
There are two lines of input. The first line contains ; the second line lists the water fetching times for each of the people, separated by single spaces.
Output Format
There are two lines of output. The first line is a queuing order, which is a permutation of to ; the second line is the average waiting time under this arrangement (rounded to two decimal places).
10
56 12 1 99 1000 234 33 55 99 812
3 2 7 8 1 4 9 6 10 5
291.90