#t354. 排队接水(water)
排队接水(water)
Queue for Water
Problem Description
There are people queuing in front of a tap to get water. Suppose the -th person takes time to get water. Find an ordering of the people such that their average waiting time is minimized.
Input Format
The first line is an integer .
The second line contains integers, where the -th integer is the water-fetching time of the -th person.
Output Format
Output two lines. The first line is an ordering that gives the shortest average waiting time. The second line is the average waiting time under this ordering (kept to two decimal places).
Sample Input
10
56 12 1 99 1000 234 33 55 99 812
Sample Output
3 2 7 8 1 4 9 6 10 5
532.00
Constraints
, ; the are not guaranteed to be distinct.