#P9684. Chair Seating Probability
Chair Seating Probability
Chair Seating Probability
There is a long table with chairs arranged in a row and labeled from to , with equal distances between any two adjacent chairs. Initially, one person sits on chair and another on chair . Then, persons enter one by one and choose seats according to the following process:
- They uniformly randomly choose an empty chair.
- After sitting, they perform a sequence of moves. At each step, let the current position be $i$ and let $$d=\min_{x\in S}\;|i-x|,$$ where $S$ is the set of already occupied chairs. They check if moving to an adjacent (left or right) chair that is empty can increase $d$. If one or both adjacent moves yield a larger minimal distance, they move to the one with the larger value (in case of a tie, they choose the left move). This process repeats until no adjacent move can increase $d$.
(It can be shown that this process terminates in a finite number of steps.)
For each chair numbered to , determine the probability that it is eventually occupied by one of the persons. All results should be printed with 6 decimal places.
inputFormat
The input consists of a single line containing two integers and where and . The chairs are numbered from to , and the initial occupied chairs are and .
outputFormat
Output numbers separated by a space. The -th number (for ) represents the probability that chair is eventually occupied, printed with 6 decimal places.
sample
1 1
1.000000