시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
---|---|---|---|---|---|
2 초 | 512 MB | 6 | 6 | 6 | 100.000% |
Two pirates are dividing looted treasures. There are $n$ treasures, the $i$-th of which costs $a_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 $n$ treasures, the $i$-th of which costs $a_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^{-9}$.
2 1 3
3.000000000000000 1.000000000000000
3 2 1 4
5.500000000000000 1.500000000000000