#T259. 排队接水

排队接水

Description

There are nn people queuing in front of a faucet to fetch water. Suppose the time taken for each person to fetch water is TiT_i, please write a program to determine an order for these nn people to queue such that the average waiting time for all nn people is minimized.

Input Format

There are two lines of input. The first line contains n(1n1000)n (1 \leq n \leq 1000); the second line lists the water fetching times T1,T2,,TnT_1, T_2, \dots, T_n for each of the nn 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 11 to nn; 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