시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
---|---|---|---|---|---|
2 초 | 512 MB | 11 | 9 | 7 | 87.500% |
Assuming that n − 1 other people with skill levels a1, a2, . . . , an−1 are standing in a queue prepared for a Rock Paper Scissors tournament and your own skill level is x, find the probability that you will win the tournament after inserting yourself into any of the n positions in the queue (before person 1, between people 1 and 2, . . ., after person n − 1):
The first line contains two integers n and x (2 ≤ n ≤ 4096; n = 2k for an integer k; 1 ≤ x ≤ 104).
The second line contains n − 1 integers a1, a2, . . . , an−1 (1 ≤ ai ≤ 104). a1 is the skill level of the person at the front of the queue, while an−1 corresponds to the person at the back.
For each of the n positions in the queue where you can insert yourself, from the front to the back, display the probability of winning the tournament.
Your answer will be considered correct if its absolute or relative error doesn’t exceed 10−9.
4 2 1 1 1
0.444444444444444 0.444444444444444 0.444444444444444 0.444444444444444
4 3 4 5 2
0.188265306122449 0.188265306122449 0.239285714285714 0.239285714285714
8 8 1 2 3 4 5 6 7
0.393768719371413 0.393768719371413 0.353382184051268 0.353382184051268 0.248207450668989 0.248207450668989 0.230924146560510 0.230924146560510
In the first test case, you beat any opponent with probability 2/3. To win the tournament, you need to beat two opponents, hence the answer is 4/9 regardless of your initial position.