No.475 Final Day - The Writer's Negligence
Note
Merry Christmas♪
Today is the final day of the Advent Calendar Contest.
Rankings are never actually determined in the way described in this problem statement.
Problem Statement
I was put in charge of the final day of the Advent Calendar Contest. However, I enjoyed Christmas too much and forgot to come up with a problem, and before I knew it, the time for the problem to be published had arrived. So I decided not to set a problem on the final day and to determine the ranking randomly instead.In other words, I resorted to the outrageous act of determining the ranking by repeating the following procedure until everyone has AC: randomly choose one participant (excluding the Writer) who does not have AC yet, and treat that participant as having AC. Assume that there are no Testers.
If the final day's problem has $S$ stars (★) and a participant's rank on that problem is $R$, that participant is given $\left\lfloor 50S+\frac{50S}{0.8+0.2R}\right\rfloor$ points. The Writer is unconditionally given $100S$ points.
Given each contest participant's score up to the previous day and the number of stars (★) of the final day's problem, find the probability that I (the Writer) can win.
Here, winning means that the total of the final day's score and the total score up to the previous day is the highest among the participants; being tied for the highest score also counts as winning.
Input
$N$ $S$ $writer\_id$
$a_0$ $a_1$ $a_2$ $a_3$ $\cdots$ $a_{N-1}$
All input values are integers.
$N$ is the number of contest participants and $S$ is the number of stars (★). Each participant is assigned a 0-based id, $0,1,\ldots, N-1$. $a_i$ represents the total score up to the previous day of the participant with id $i$, and $writer\_id$ represents the id of the Writer (me).
$3\leqq N\leqq 77777$
$1\leqq S\leqq 500000$
$0\leqq a_i\leqq 100000000$
Output
Output on one line the probability that I can win. An absolute or relative error of at most $10^{-9}$ is allowed.
Do not forget the newline at the end.
Sample
Sample 1
Input
3 3 0 1 0 2
Output
0.5
The final day's problem has 3 stars (★), and 300 points and 275 points are given in order from the highest rank.
The Writer has $1+300=301$ points. If the participant with id 1 is ranked 1st and the participant with id 2 is ranked 2nd, I can win.
Sample 2
Input
3 3 0 2 2 2
Output
1.0
The Writer receives 300 points, but whichever of the other two participants takes 1st place on the final day, the Writer can win.
Sample 3
Input
20 3 5 6834 6368 6098 5975 5962 5516 5453 5102 4866 4692 4679 4652 4650 4481 4324 4181 4150 3934 3784 3628
Output
0.0
This data is the actual data of the top 20 participants as of 9 p.m. on December 24, with $writer\_id$ set to me. Apparently, even under this rule, the probability that I win is 0.0. Oh well...
提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。
chaemon
🐬hec