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

15609번 - Knockout Tournament 스페셜 저지다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
2 초 512 MB68393759.677%

문제

Laura is organising a knockout tournament, in which her friend Dale takes part. Laura would like to maximise the probability of Dale winning the tournament by arranging the games in a favourable way. She does not know how to do it, so she asked you for help. Naturally, you refuse to cooperate with such a deplorable act—but then you realise that it is a very nice puzzle!

When the number of players is a power of two, the tournament setup can be described recursively as follows: the players are divided into two equal groups that each play their own knockout tournament, after which the winners of both tournaments play each other. Once a player loses, they are out of the tournament.

When the number of players is not a power of two, some of the last players in the starting line-up advance from the first round automatically so that in the second round the number of players left is a power of two, as shown in Figure K.1.

Figure K.1: A tournament tree with 5 players. Players C, D, and E advance from the first round automatically.

Every player has a rating indicating their strength. A player with rating a wins a game against a player with rating b with probability a/(a+b) (independently of any previous matches played).

Laura as the organiser can order the starting line-up of players in any way she likes. What is the maximum probability of Dale winning the tournament?

입력

The input consists of:

  • One line with an integer n (2 ≤ n ≤ 4096), the total number of players.
  • n lines, each with an integer r (1 ≤ r ≤ 105), the rating of a player. The first rating given is Dale’s rating.

출력

Output the maximum probability with which Dale can win the tournament given a favourable setup. Your answer should have an absolute or relative error of at most 10−6.

제한

예제 입력 1

4
3
1
2
4

예제 출력 1

0.364285714

예제 입력 2

5
1
1
3
3
3

예제 출력 2

0.125

힌트

출처

ICPC > Regionals > Europe > Northwestern European Regional Contest > NWERC 2017 K번

  • 문제를 만든 사람: Thomas Beuman
(追記) (追記ここまで)

출처

대학교 대회

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

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