Game Show Elimination
Time limit8sMemory limit2048 MB
Given n contestants with uniform skill ranges [i, i+k], find each contestant's expected rank when the weekly runner-up is eliminated until one remains.
- Level
Medium7 of 10
- Topics
- Probability, Dynamic programming
- Solved
- No attempts yet
Problem
You are running an elimination-style game show. Players are eliminated one at a time until only one remains. Using what you know about the contestants, you predict the results.
Each week, the remaining contestants take part in a competition. Each contestant's score is a random real number within that contestant's own skill range. The contestants are ranked from highest to lowest score. Since scores are real numbers, the probability of a tie is zero.
The winner of the week's competition chooses who is eliminated. All players believe they should pick whoever did best after them, so the winner always eliminates the second place contestant. That contestant leaves the show. This repeats week after week until one contestant is left.
A contestant's final rank depends on when they leave. The last contestant to leave (the winner) gets rank , the second-to-last gets rank , and so on, until the first person to leave gets the lowest rank.
Given the skill ranges, compute the expected rank of each player.
Input
The single line of input contains two integers () and (), where is the number of contestants and determines the skill range. Contestants are numbered from to . The skill range of contestant is from to inclusive, and their score each week is a random real number in this range.
Output
Output lines. Each line contains a single real number, the expected rank of a contestant, listed in contestant number order. Answers are accepted within an absolute or relative error of at most .