| 시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
|---|---|---|---|---|---|
| 1 초 | 2048 MB | 15 | 14 | 14 | 93.333% |
You are following the world championship of the Billion Players Game. There are $10^9$ players competing, and you want to predict the final ranking $p$ of Godflex, your favorite streamer. After analyzing recent matches, you are sure that $l ≤ p ≤ r$, but you don’t know anything else.
There are $n$ offers made by the in-game bookmaker. In the $i$-th offer, the bookmaker suggests an estimation $a_i$ for Godflex’s final ranking. For each offer, you must choose exactly one of the following actions:
After you decide how to deal with all the offers, the actual Billion Players Game is played. Godflex gets an integer position $p$ in $[l, r]$, 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 $p$ in $[l, r]$. Find the maximum possible score you can guarantee.
Each test contains multiple test cases. The first line contains the number of test cases $t$ ($1 ≤ t ≤ 10^4$). The description of the test cases follows.
The first line of each test case contains three integers $n$, $l$, $r$ ($1 ≤ n ≤ 2 \cdot 10^5$, $1 ≤ l ≤ r ≤ 10^9$) — the number of offers and the possible range of Godflex’s final ranking.
The second line of each test case contains $n$ integers $a_1, a_2, \dots , a_n$ ($1 ≤ a_i ≤ 10^9$) — the bookmaker’s estimations of Godflex’s ranking in each offer.
It is guaranteed that the sum of $n$ over all test cases does not exceed $2 \cdot 10^5$.
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
In the first test case, there is only one offer.
So the maximum possible score is $0$.
In the second test case, it is optimal to accept the offers claiming that $p ≥ 50$ and $p ≤ 200$. Since $p$ must be $100$, you gain $|100 − 50| + |100 − 200| = 150$ coins.
ICPC > Regionals > Europe > Southwestern European Regional Contest > SWERC 2025 B번