#P472. 练85.2 排队接水
练85.2 排队接水
Description
There are people waiting in line at a water tap. If the time for the -th person to fill water is , please write a program to find a queuing order for these people that minimizes the average waiting time.
Input Format
The input consists of two lines. The first line contains (). The second line contains integers , , ..., representing the water filling time for each person from 1 to , separated by spaces. It is guaranteed that all values are distinct.
Output Format
The output consists of two lines. The first line contains a queuing order, which is a permutation of numbers from 1 to . The second line contains the average waiting time for this arrangement (accurate to two decimal places).
Sample
10
56 12 1 99 1000 234 33 55 99 8123 2 7 8 1 4 9 6 10 5
291.90