{"trustable":true,"sections":[{"title":"Description","value":{"format":"MD","content":"There are $n$ people waiting in line to get water from a faucet. If each person takes $T_i$ time to get water, please write a program to find a sequence for these $n$ people in line that minimizes the average waiting time for $n$ people."}},{"title":"Input","value":{"format":"MD","content":"The first line contains an integer $n$.\n\nThe second line contains $n$ integers, where the $i$th integer $T_i$ represents the time taken by the $i$th person to get water, $T_i$."}},{"title":"Output","value":{"format":"MD","content":"The output consists of two lines. The first line is the sequence that minimizes the average waiting time. The second line is the average waiting time under this arrangement (output the result accurate to two decimal places)."}},{"title":"Sample 1","value":{"format":"MD","content":"\u003ctable class\u003d\u0027vjudge_sample\u0027\u003e\n\u003cthead\u003e\n \u003ctr\u003e\n \u003cth\u003eInput\u003c/th\u003e\n \u003cth\u003eOutput\u003c/th\u003e\n \u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n \u003ctr\u003e\n \u003ctd\u003e\u003cpre\u003e10 \n56 12 1 99 1000 234 33 55 99 812\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e3 2 7 8 1 4 9 6 10 5\n291.90\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e"}},{"title":"Hint","value":{"format":"MD","content":"$1\\le n \\leq 1000$, $1\\le t_i \\leq 10^6$, and there is no guarantee that $t_i$ are not repeated."}}]}