#P17005. [NWERC 2019] Gnoll Hypothesis

    ID: 19281 远端评测题 1000ms 512MiB 尝试: 0 已通过: 0 难度: 6 上传者: 标签>2019Special Judge组合数学概率论ICPC

[NWERC 2019] Gnoll Hypothesis

Problem Description

You are a huge fan of the RPG The Eldest Scrolls: Earthrim and know all of the game’s internal mechanics. For instance, when spawning a new monster, each of the nn different types of monsters in the game has some fixed probability of appearing, and you know exactly what this probability distribution over monster types is.

However, in the latest update the developers seem to have changed the way monsters are spawned. After some testing and reverse engineering, you realise that instead of spawning all nn types of monsters, each spawn location only has a spawn pool of kk monster types. These spawn pools are chosen randomly at the start of the game, independently for each spawn location, with every monster type having the same chance of being chosen for the spawn pool. And apparently a developer was lazy with adjusting the spawn chances. Instead of normalising the spawn chances of the kk chosen types, the developer decided that if a type of monster is not chosen, its spawn chance is added to the next chosen monster type in the list of types (and if monster types at the end of the list are not chosen, their spawn chances are added to the first chosen monster type in the list). For example, Figure shows a small example with n=5n=5 monsters, a possible random choice of k=3k=3 of those monsters, and the resulting spawn probabilities for those 33 monsters.

:::align{center} :::

After the update, some monster types seem to appear less often than before, and some more often (for instance now there seem to be Gnolls all over the place). You believe that the new spawning logic may be responsible for this by having changed the effective spawn chances of the monsters. In order to test this hypothesis, you decide to compute these effective spawn chances after the update.

Input Format

The input consists of:

  • One line with two integers nn and kk (1kn5001 \le k \le n \le 500), the number of different types of monsters and the number of monsters that are randomly chosen for the spawn pool of each spawn location.

  • One line with nn real numbers s1,s2,,sns_1, s_2, \ldots, s_n (si0s_i \ge 0 for each ii, j=1nsj=100\sum^{n}_{j=1}s_j = 100), where sis_i is the spawn chance in percent for the iith type in the list of monster types. Every real number has at most six digits after the decimal point.

Output Format

Output a single line containing nn real numbers, the effective spawn chance in percent of each type of monster. The iith number in your output should correspond to the iith type of monster. Your answers should have an absolute or relative error of at most 10610^{-6}.

5 3
1 25 39 12 23
8.7 17.6 31 21.4 21.3
3 2
2.019 87.51234 10.46866
4.8355533 59.01456 36.1498867