Problem list
Log in
#icpc00153 · ICPC SWERC 2022

Uniform Chemistry

Gold II 2.0 s 2048 MB

In a parallel universe there are $n$ chemical elements, numbered from 1 to $n$. The element number $n$ has not been discovered so far, and its discovery would be a pinnacle of research and would bring the person who does it eternal fame and the $so-ca$lled SWERC prize. There are $m$ independent researchers, numbered from 1 to $m$, that are trying to discover it. C$ur- re$ntly, the $i-th$ researcher has a sample of the element $s_{i}$. Every year, each researcher independently does one fusion experiment. In a fusion experiment, if the researcher currently has a sample of element $a$, they produce a sample of an element $b$ that is chosen uniformly at random between $a+1$ and $n$, and they lose the sample of element $a$. The elements discovered by different researchers or in different years are completely independent. The first researcher to discover element $n$ will get the SWERC prize. If several researchers discover the element in the same year, they all get the prize. For each $i = 1$, 2, . . . , $m$, you need to compute the probability that the $i-th$ researcher wins the prize.

Input

The first line contains two integers $n$ and $m$ ($2 \le n \le 100$, $1 \le m \le 10$) — the number of elements and the number of researchers. The second line contains $m$ integers $s_{1}$, $s_{2}$, . . . , $s_{m}$ ($1 \le s_{i} < n$) — the elements that the researchers currently have.

Output

Print $m$ floati$ng-po$int numbers. The $i-th$ number should be the probability that the $i-th$ researcher wins the SWERC prize. Your answer is accepted if each number differs from the correct number by at most $10^{−8}$.

Example 1

Input
2 3
1 1 1
Output
1.0 1.0 1.0

Example 2

Input
3 3
1 1 2
Output
0.5 0.5 1.0

Example 3

Input
3 3
1 1 1
Output
0.625 0.625 0.625

Example 4

Input
100 7
1 2 4 8 16 32 64
Output
0.178593469 0.179810455 0.182306771
0.187565366 0.199300430 0.229356322
0.348722518
Source
ICPC SWERC 2022
Appears in
Not part of a ladder, contest or set yet.
Accepted 0 Submissions 0 Acceptance 0% Solvers 0

Discussion

Threads about this problem. Spoilers are collapsed; wrap hints in ||double bars||.

No discussion yet. Start a thread if something here needs explaining.

Recent submissions Open with filters
Code