CP. 排队接水

    Type: Default 1000ms 256MiB

排队接水

You cannot submit for this problem because the contest is ended. You can click "Open in Problem Set" to view this problem in normal mode.

Background

无

Description

有n个人在一个水龙头前排队接水,假如每个人接水的时间为Ti,请编程找出这n个人排队的一种顺序,使得n个人的平均等待时间最小。

Format

Input

第一行为一个整数n。(n<=1000) 第二行n个整数,第i个整数Ti表示第i个人的等待时间Ti。(Ti<=10e6,当Ti重复时按照输入顺序即可)

Output

输出文件有两行,第一行为一种平均时间最短的排队顺序;第二行为这种排列方案下的平均等待时间(输出结果精确到小数点后两位)。

Samples

10 
56 12 1 99 1000 234 33 55 99 812
3 2 7 8 1 4 9 6 10 5
291.90

Limitation

1s, 1024KiB for each test case.

第七届SWPU-ACM新生预选赛

Not Attended
Status
Done
Rule
XCPC
Problem
103
Start at
2022-9-19 14:00
End at
2022-10-28 14:00
Duration
936 hour(s)
Host
Partic.
58