Problem D
Double Sort
Given two integers $n$ and $m$ ($n \le m$), you generate a sequence of $n$ integers as follows:
-
First, choose $n$ distinct integers between $1$ and $m$, inclusive.
-
Sort these numbers in non-decreasing order.
-
Take the difference sequence, which transforms a sequence $a_1$, $a_2$, $a_3$, $\ldots $ into $a_1$, $a_2-a_1$, $a_3-a_2$, $\ldots $
-
Sort the difference sequence in non-decreasing order.
-
Take the prefix sums of the sorted difference sequence to get the final sequence. This transforms a sequence $b_1$, $b_2$, $b_3$, $\ldots $ into $b_1$, $b_2+b_1$, $b_3+b_2+b_1$, $\ldots $
For example, with $n = 3$ and $m = 10$:
-
Suppose we initially chose $6$, $2$, $9$.
-
The sequence in order is $2$, $6$, $9$.
-
The difference sequence is $2$, $4$, $3$.
-
The sorted difference sequence is $2$, $3$, $4$.
-
The prefix sums of the sorted difference sequence are $2$, $5$, $9$.
Suppose you chose a uniformly random set of distinct integers for step $1$. Compute the expected value for each index in the final sequence.
Input
The single line of input contains two integers $n$ ($1 \le n \le 50$) and $m$ ($n \le m \le 10\, 000$), where $n$ is the size of the sequence, and all of the initial integers chosen are in the range from $1$ to $m$.
Output
Output $n$ lines. Each line contains a single real number, which is the expected value at that index of the final sequence. Each answer is accepted with absolute or relative error at most $10^{-6}$.
Sample Input 1 | Sample Output 1 |
---|---|
3 5 |
1 2.3 4.5 |