0% found this document useful (0 votes)
24 views

Prob Goals

The document describes a soccer match between Quang and Trong. Each player is given N balls randomly weighted between 1 and 1018. Quang shoots first, placing one ball in each of N goals in any order. Trong then shoots in a way to maximize his score, knowing Quang's placements. Quang aims to maximize his expected score, not knowing Trong's balls. The program takes N as input and outputs Quang's expected total score to 6 decimal places.

Uploaded by

dungakaishi900
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
24 views

Prob Goals

The document describes a soccer match between Quang and Trong. Each player is given N balls randomly weighted between 1 and 1018. Quang shoots first, placing one ball in each of N goals in any order. Trong then shoots in a way to maximize his score, knowing Quang's placements. Quang aims to maximize his expected score, not knowing Trong's balls. The program takes N as input and outputs Quang's expected total score to 6 decimal places.

Uploaded by

dungakaishi900
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

The 2023 ICPC Vietnam

Southern Provincial Programming Contest


University of Science, VNU-HCM
October 15th, 2023
Problem G
Goals
Time Limit: 1 second
Memory Limit: 512 megabytes
Quang and Trong participate in a special soccer match. In this competition,
each of them is given 𝑁 soccer balls at random, each with a random weight
in the range of [1, 1018 ].
The match unfolds as follows: the soccer field has 𝑁 goals, numbered from
1 to 𝑁. Quang kicks off the game by shooting his 𝑁 balls into these 𝑁
goals, with one ball going into each goal (assuming both Quang and Trong
have 100% shooting accuracy). He is free to choose the order in which the
balls are shot. After Quang has taken all his shots, Trong considers the
weight of Quang’s balls in the current goals and then decides to shoot his
𝑁 balls into the corresponding 𝑁 goals, each ball into each goal.
At the end of the match, for the 𝑖 𝑡ℎ goal, the player whose ball has a higher weight wins and gets 𝑖 score
(𝑖 = 1, 2, . . . , 𝑁). If both balls in the 𝑖 𝑡ℎ goal have the same weight, the score is split equally, meaning
each player gets i/2 score. The player who has a higher total score wins the match.
As an example of the match, suppose 𝑁 = 3, Quang is given 𝑁 balls with weights 1, 2, and 4, and
Thuc is given balls with weights 1, 3, and 5. Quang may shoot balls weighted 4, 2 and 1 on goals 1, 2
and 3, respectively. After seeing Quang's moves, Trong may shoot the balls weighted 3, 5 and 1 on
goals 1, 2 and 3, respectively. In this case, Quang earns 1 point for slot 1, 0 points for slot 2, and
3/2 = 1.5 points for slot 3. His total score is 2.5 points. The purpose of the above example is to
illustrate the rules of the match. Quang and Trong may not shoot the balls as described because both
play optimally.
Knowing that, during his turn, Trong is aware of the positions of Quang's balls. Trong chooses his
shooting strategy to maximize the score he can earn. Meanwhile, during Quang's turn, he does not know
the information about Trong's balls. Still, he is aware of Trong's optimal strategy and that the ball
weights are uniformly and randomly distributed. Hence, Quang chooses his playing strategy to
maximize the expected value of his total score.
Given 𝑁, please help Quang calculate the expected value of his total score at the end of the match if
both players make their choices optimally as described.
Input
The input contains a single integer 𝑁 (1 ≤ 𝑁 ≤ 100), the number of goals.
Output
A single number indicating the expected value of Quang’s total score at the end of the match. The result
must have exactly six digits after decimal point, rounded if necessary.
Sample Input Sample Output
1 0.500000
2 1.333333
100 598.874902

You might also like