#P14763. [Opoi 2025] CCD 的赌局
[Opoi 2025] CCD 的赌局
Background
The casino run by CCD is on the verge of bankruptcy, so he has to try something new.
Problem Description
A formal statement is given below.
CCD decides to make profits by cheating. He invites two OIers, Xiao L and Xiao T, who are suffering after misreading an exam problem, to act as insiders.
Specifically, CCD lets Xiao L and Xiao T play rounds, and in each round exactly one person wins.
To take this chance to make a big profit, CCD advertises heavily and attracts a large crowd to bet (betting on who wins each round). To make the gambling look more attractive, CCD decides that the sum of the per-unit payout for Xiao L winning and the per-unit payout for Xiao T winning is . Also, to earn even more money, CCD may change the per-unit payouts between two consecutive rounds, but the sum must still be , and he can change them at most once. Unfortunately, the insiders Xiao L and Xiao T have already colluded with others in private: in each round, they will always choose the outcome with the larger payout. (For example, if the payout when Xiao L wins in this round is larger than the payout when Xiao T wins, then they will manipulate the result so that Xiao L wins.)
Now CCD somehow knows the total bet amounts on both sides in each round, denoted by . He wants to set the payouts twice (or once) to minimize the total money he finally pays back, and asks you to compute this minimum value.
Per-unit payout and total payout: If in this round the per-unit payout for Xiao L is and for Xiao T is , and other people bet dollars on Xiao L to win and dollars on Xiao L to win, then if Xiao L wins the total payout increases by dollars; but if Xiao L loses, the total payout increases by dollars.
Formal Statement
Given , , and two real sequences , .
You may choose any non-negative real numbers and an integer , such that . Find the minimum value of the following expression:
$$\sum_{i=1}^{k}\max(A_1\times a_i, B_1 \times b_i) + \sum_{i=k+1}^{n}\max(A_2\times a_i, B_2 \times b_i)$$In particular, when , define to be .
Input Format
The first line contains an integer and a non-negative real number .
The next lines each contain two non-negative real numbers , meaning the total bet amounts on Xiao L and Xiao T in the -th round.
Output Format
Output one real number: the minimum total payout, rounded to two digits after the decimal point.
2 1.00
4.00 12.00
12.00 4.00
6.00
Hint
Sample Explanation
Before the first round, set the per-unit payouts for Xiao L and Xiao T to and , respectively.
After the first round, change the per-unit payouts for Xiao L and Xiao T to and , respectively.
Then the minimum total payout is $\max(4\times 0.75,12\times 0.25)+\max(12\times 0.25,4\times 0.75)=6$.
Constraints and Notes
This problem uses bundled testdata.
$$\def\arraystretch{1.2} \begin{array}{|c|c|c|} \hline \begin{array}{c} \tt{subtask}\\\hline 1\\\hline 2\\\hline 3\\\hline \end{array} & \begin{array}{c} n\\\hline \le 10\\\hline \le 10^{3}\\\hline \le 10^{5}\\ \end{array} & \begin{array}{c} \tt{pts}\\\hline 10\\\hline 40\\\hline 50\\\hline \end{array} \\\hline \end{array}$$For all testdata, , , and . All real numbers in the input file are accurate to two decimal places.
Translated by ChatGPT 5