409675: GYM103677 L French Raisins

Memory Limit:256 MB Time Limit:1 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

L. French Raisinstime limit per test1.2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard output

While the COVID-19 pandemic is not over just quite yet, Mark had decided to make the most of his time during the pandemic by studying abroad in France. While France is known for its fine dining, Mark happened to visit a famous winery one day and was inspired to have some raisins as a snack.

Mark decided that he wanted to eat $$$n$$$ raisins today, and every few minutes or so, he picks out two raisins $$$i$$$ and $$$j$$$, and with some probability, decides to eat raisin $$$i$$$. If he does not eat raisin $$$i$$$, then he will eat raisin $$$j$$$. Regardless, the raisin that he did not eat is put back into the bowl. As it turns out, while it is completely random which two raisins Mark will pick out of the remaining raisins, the probability he picks any raisin $$$i$$$ over a raisin $$$j$$$ is predetermined. In the end, when there is only $$$1$$$ raisin left, that raisin has a brief momentary victory before being gobbled up by Mark.

Mark of course is satisfied with his raisins, but given the probabilities that he picks any raisin $$$i$$$ over any other raisin $$$j$$$, help him determine the probabilities of each raisin being the last one left!

Input

The first line of input will contain $$$n (1 \le n \le 17)$$$, the number of raisins that Mark will consume today.

The next $$$n$$$ lines each contain $$$n$$$ space separated probabilities, where the $$$j^{th}$$$ entry in the $$$i^{th}$$$ row is the probability that the $$$i^{th}$$$ raisin would win out (and not be eaten when matched up) against the $$$j^{th}$$$, if they were matched up. Note that the $$$i^{th}$$$ entry in the $$$j^{th}$$$ added to the $$$j^{th}$$$ entry in the $$$i^{th}$$$ row will always equal $$$1$$$, and that if $$$i = j$$$, then the entry will be $$$0$$$.

Output

Output $$$n$$$ lines, where each line is the probability that the $$$i^{th}$$$ raisin is the last raisin. Your answer will be correct if each of the probabilities is within an absolute or relative error of $$$10^{-6}$$$.

ExampleInput
3
0 0 0
1 0 0.8
1 0.2 0
Output
0
0.8
0.2

加入题单

算法标签: