아직 만들고 있는 페이지입니다.

이 페이지는 아직 만드는 중입니다. 보이는 내용은 바뀔 수 있습니다.

Two Pirates - 2

시간 제한2초메모리 제한512 MB

요약
첫 번째 해적은 최적으로 고르고 두 번째 해적은 남은 보물 중 하나를 무작위로 고를 때, 두 해적이 가져가는 보물 가치 합의 기댓값을 구한다.
난이도

보통10점 중 6점

유형
게임 이론, 확률, 정렬
정답자
아직 제출이 없습니다

문제

Two pirates are dividing looted treasures. There are nn treasures, the ii-th of which costs a_ia\_i gold. They move in rotation, each turn a pirate picks one of the remaining treasures. The thing is, the second pirate is drunk, so he doesn't make optimal picks and each turn just picks a random available treasure, uniformly. The first pirate knows that and always makes the optimal picks.

Find the expected costs of treasures picked by both pirates.

입력

Two pirates are dividing looted treasures. There are nn treasures, the ii-th of which costs a_ia\_i gold. They move in rotation, each turn a pirate picks one of the remaining treasures. The thing is, the second pirate is drunk, so he doesn't make optimal picks and each turn just picks a random available treasure, uniformly. The first pirate knows that and always makes the optimal picks.

Find the expected costs of treasures picked by both pirates.

출력

Output two floating point numbers: the expected costs of treasures picked by the first and the second pirates.

Absolute or relative error of the numbers shouldn't exceed 10−910^{-9}.

예제2

  1. 예제 1

    입력
    2
    1 3
    
    예상 출력
    3.000000000000000 1.000000000000000
    
  2. 예제 2

    입력
    3
    2 1 4
    
    예상 출력
    5.500000000000000 1.500000000000000