National Olympiad in Informatics, China, 2008
With the Olympics right around the corner, students' interest in physical education is skyrocketing. As NOI 2008 approaches, the school is currently planning to host a ping-pong tournament. Beings a very avid ping-pong enthusiast, this is the perfect opportunity for little Z to show off his skills. Thus, he quickly registers himself and begins his intensive preparation.
The tournament will follow a single-elimination format where only the
winners of a round advance. There just happens to be
Slot 1 | Slot 2 | Slot 3 | Slot 4 | Slot 5 | Slot 6 | Slot 7 | Slot 8 |
Winner of Slots 1 and 2 | Winner of Slots 3 and 4 | Winner of Slots 5 and 6 | Winner of Slots 7 and 8 | ||||
Winner of Slots 1, 2, 3, and 4 | Winner of Slots 5, 6, 7, and 8 | ||||||
Champion |
To attract more students, the prizes of the tournament are very
generous. The competitors being eliminated in round
In the warm-up rounds prior to the real tournament, little Z was repeatedly defeated. After some careful analysis, he concluded that the key reason behind his failure was not an issue of his skill, but was because the students who defeated him just happened to clash with his playing stylistically. Little Z thought to himself, how nice would it be if these students could be avoided in the actual tournament!
Let's assume that we already know the probabilities of winning for all
contestants in pairwise matches. The probability of contestant
Input Specification
There are match1.in
to match10.in
that will be given to
your program (through standard input). They can be downloaded here for
you to study:
match.zip
The first line of each test case contains an integer from matchx.in
will have x
on the first
line).
The second line contains a single integer
For the following
For the following
Output Specification
Output
Sample Input
0
4
0.00 0.70 0.60 0.80
0.30 0.00 0.60 0.40
0.40 0.40 0.00 0.70
0.20 0.60 0.30 0.00
1
2
3
Sample Output
1
4
2
3
Explanation
After the first round is over, the probability for contestant
In the second round (the championship match), the probability of
contestant
Experimentation
We supply a tool match_check.py for you to test whether your solutions are accepted. The usage for this program is
match_check.py <input-file> <output-file>
When you execute match_check.py
, the program will process your input
and output files and print the result to standard output. Possible
results of the execution include:
Abnormal termination
: An unknown error occurred.Format error
: The output file is incorrectly formatted.Not a permutation
: The output file is not a permutation of the integers from to .OK. Your answer is x
: The output will be accepted. will be the expected prize money.
Scoring
Each test case will be graded independently.
For each test case, if your output is illegal (i.e. has invalid
formatting, doesn't fit with the requirements, etc.) then you will
receive a score of 0.
Otherwise, if the expected prize money for your output is
, if . , if .- Otherwise, your score will be:
Hint
"Expected Value"
The mathematical expected value is the most fundamental property of a
random variable. It reflects the size of the average value of a random
variable, also known as the expectation or mean. It is an extension of
the simple arithmetic mean, or a weighted average of all the possible
values. Ex. If a city has
To calculate the random variable for this problem, assume that little
Z's chances of losing the first round is
Problem translated to English by .
Comments