#P2531. [SHOI2001] 三国围棋对抗赛
[SHOI2001] 三国围棋对抗赛
Description
The rules are as follows: first, a draw determines the team that has a bye in round . Then the No. players of the two non-bye teams play; the loser is eliminated. Thereafter, in each round, the previous winner plays against the smallest-index remaining player from the team that had the bye in the previous round. This continues until only one country still has players remaining; that country wins.
Note: When only two teams still have players not eliminated, ignore byes. In each round, the two smallest-index players from those two teams play, and the loser is eliminated.
Input Format
The first line contains a number , the number of candidates for Team China.
Then follow lines, each containing numbers.
In line , the numbers are the win probabilities of Chinese candidate against Korea No. and Japan No. , respectively; each probability is .
Next are lines, each containing numbers.
In line , the -th number is the win probability that Korea player defeats Japan player .
Output Format
Output a single line: the maximum winning probability for Team China, to decimal places.
5
0.902 0.540 0.862 0.283 0.498 0.597 0.900 0.076 0.750 0.539
0.342 0.574 0.743 0.442 0.579 0.502 0.755 0.649 0.835 0.278
0.105 0.704 0.274 0.733 0.725 0.861 0.007 0.314 0.099 0.542
0.785 0.754 0.541 0.331 0.430 0.426 0.928 0.385 0.314 0.892
0.349 0.354 0.408 0.353 0.333 0.180 0.715 0.013 0.563 0.386
0.131 0.564 0.265 0.700 0.033
0.293 0.688 0.140 0.130 0.550
0.346 0.915 0.385 0.536 0.946
0.739 0.051 0.682 0.166 0.436
0.122 0.065 0.724 0.934 0.736
0.529237
Hint
Translated by ChatGPT 5
京公网安备 11011102002149号