#P15136. [SWERC 2025] Billion Players Game
[SWERC 2025] Billion Players Game
题目描述
You are following the world championship of the Billion Players Game. There are players competing, and you want to predict the final ranking of Godflex, your favorite streamer. After analyzing recent matches, you are sure that , but you don’t know anything else.
There are offers made by the in-game bookmaker. In the -th offer, the bookmaker suggests an estimation for Godflex’s final ranking. For each offer, you must choose exactly one of the following actions:
- Ignore the offer.
- Accept the offer by claiming that . If you are right, you earn coins; otherwise you lose coins.
- Accept the offer by claiming that . If you are right, you earn coins; otherwise you lose coins.
After you decide how to deal with all the offers, the actual Billion Players Game is played. Godflex gets an integer position in , and then all the offers are settled up.
Your total score is the number of coins you are guaranteed to earn, that is, the minimum number of coins you earn over all possible values of in . Find the maximum possible score you can guarantee.
输入格式
Each test contains multiple test cases. The first line contains the number of test cases (). The description of the test cases follows.
The first line of each test case contains three integers (, ) — the number of offers and the possible range of Godflex’s final ranking.
The second line of each test case contains integers () — the bookmaker’s estimations of Godflex’s ranking in each offer.
It is guaranteed that the sum of over all test cases does not exceed .
输出格式
For each test case, output a single line containing an integer: the maximum possible score you can guarantee.
4
1 1 5
3
2 100 100
50 200
5 1 10
5 7 3 9 1
5 6 10
9 3 1 7 5
0
150
12
13
提示
Explanation of sample 1.
In the first test case, there is only one offer.
- If you ignore the offer, your score is 0;
- if you accept the offer claiming that , your score is (reached when , which makes you lose coins);
- if you accept the offer claiming that , your score is (reached when , which makes you lose coins).
So the maximum possible score is 0.
In the second test case, it is optimal to accept the offers claiming that and . Since must be 100, you gain coins.