Logo
(追記) (追記ここまで)

19094번 - Seats 스페셜 저지다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1.5 초 256 MB247583.333%

문제

In the game of Seats there are $n$ seats and $n$ players. The $i$-th seat initially contains a prize of $a_i$ dollars. The prize is meant to be collected by the player that will manage to take the $i$-th seat.

Before the game starts, each player chooses a single seat they would like to sit on. When the game starts, all players run toward their chosen seats and fight for it. We assume that all the players fighting for some seat are equally likely to sit down on that chair and collect the prize. After the fight, exactly one of these players will manage to take that seat. The players that fail to take their chosen seat gain nothing.

Suppose all the players choose their seat by sampling it from some fixed probability distribution that is identical for all players. What is the maximum expected prize of a player if the distribution is chosen optimally?

Consider the following example. Let $n=2,ドル $a_1=1$ and $a_2=2$. If all players decide to go for the "more profitable" seat 2ドル$ with probability 1ドル,ドル the expected prize for each of them will be $\frac{1}{2}\cdot 2=1$ dollar. However, if the seats 1ドル$ and 2ドル$ are assigned probabilities $\frac{1}{3}$ and $\frac{2}{3}$ respectively, each player will gain $\frac{7}{6}$ dollars in expectation.

입력

The first line of the input contains a single integer $n$ (1ドル\leq n\leq 5000$). The second line of the input contains $n$ integers $a_1,\ldots,a_n$ (1ドル\leq a_i\leq 1000$), denoting the prizes assigned to the respective seats.

출력

You should output the expected prize of a single player provided that the probability distribution is chosen optimally. Your answer will be considered correct if its absolute or relative error does not exceed 10ドル^{-7}$.

제한

예제 입력 1

3
2 1 4

예제 출력 1

1.785911591670981

힌트

출처

Camp > Petrozavodsk Programming Camp > Summer 2017 > Day 6: Warsaw U Contest, XVII OpenCup Onsite E번

(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /