eolymp
bolt
Try our new interface for solving problems
Problems

World Championship

World Championship

\includegraphics{https://static.e-olymp.com/content/c3/c380ea5369476a2554f33b5353764d2632e369f7.jpg} \textbf{Woods in the spring. 1884.} \textit{Landscape differs fine gradation of color, freedom and diversity of artistic methods, while maintaining a rigorous, realistic exact figure.} In the finals of the World Cup in France involved \textbf{16} teams. The winner is determined on the Olympic system: \includegraphics{https://static.e-olymp.com/content/8a/8ad471d361854f0b1f9342025628e34562171240.jpg} Known probability of winning (percentage) of each team in each group. Necessary for each team to calculate the probability that she wins the tournament (will become the champion of the world). \InputFile Consists of several tests. The first line of each test contains a number of teams in the league \textbf{n} (\textbf{4} ≤ \textbf{n} ≤ \textbf{64}, \textbf{n} is a power of two). The following n lines describe the names of teams, each of which contains no more than \textbf{10} characters. The following is a matrix of probabilities \textbf{p} size \textbf{n} × \textbf{n}. Cell \textbf{p}\[\textbf{i}\]\[\textbf{j}\] contains a non-negative integer value is the probability of a percentage, to which \textbf{i}-th team will win in the \textbf{j}-th. It is obvious that \textbf{p}\[\textit{\textbf{i}}\]\[\textit{\textbf{j}}\] + \textbf{p}\[\textit{\textbf{j}}\]\[\textit{\textbf{i}}\] = \textbf{100\%}. \OutputFile For each test case print its number. For each team find the probability (in percents) to become a World Champion. Print the countries in the same order as they given in the input. Print the team names left-justified in a field of \textbf{10} characters. After each country name print one space and the percent probability to win the cup as shown below.
Time limit 1 second
Memory limit 64 MiB
Input example #1
16
Brazil
Chile
Nigeria
Denmark
Holland
Yugoslavia
Argentina
England
Italy
Norway
France
Paraguay
Germany
Mexico
Romania
Croatia
50 65 50 60 55 50 50 65 45 55 40 55 40 55 50 50
35 50 35 45 40 35 35 50 30 40 25 40 25 40 35 35
50 65 50 60 55 50 50 65 45 55 40 55 40 55 50 50
40 55 40 50 45 40 40 55 35 45 30 45 30 45 40 40
45 60 45 55 50 45 45 60 40 50 35 50 35 50 45 45
50 65 50 60 55 50 50 65 45 55 40 55 40 55 50 50
50 65 50 60 55 50 50 65 45 55 40 55 40 55 50 50
35 50 35 45 40 35 35 50 30 40 25 40 25 40 35 35
55 70 55 65 60 55 55 70 50 60 45 60 45 60 55 55
45 60 45 55 50 45 45 60 40 50 35 50 35 50 45 45
60 75 60 70 65 60 60 75 55 65 50 65 50 65 60 60
45 60 45 55 50 45 45 60 40 50 35 50 35 50 45 45
60 75 60 70 65 60 60 75 55 65 50 65 50 65 60 60
45 60 45 55 50 45 45 60 40 50 35 50 35 50 45 45
50 65 50 60 55 50 50 65 45 55 40 55 40 55 50 50
50 65 50 60 55 50 50 65 45 55 40 55 40 55 50 50
Output example #1
Test 1:
Brazil     p=8.54%
Chile      p=1.60%
Nigeria    p=8.06%
Denmark    p=2.79%
Holland    p=4.51%
Yugoslavia p=7.50%
Argentina  p=8.38%
England    p=1.56%
Italy      p=9.05%
Norway     p=3.23%
France     p=13.72%
Paraguay   p=3.09%
Germany    p=13.79%
Mexico     p=3.11%
Romania    p=5.53%
Croatia    p=5.53%
Source Медведев М.Г. - Зимняя школа в Харькове 2009