当前你的浏览器版本过低,网站已在兼容模式下运行,兼容模式仅提供最小功能支持,网站样式可能显示不正常。
请尽快升级浏览器以体验网站在线编辑、在线运行等功能。

建议使用的浏览器:

谷歌Chrome 火狐Firefox Opera浏览器 微软Edge浏览器 QQ浏览器 360浏览器 傲游浏览器

7075:Unfair contest

题目描述
I'm going to give my scores fairly. It's just that some contestant deserves a fairer score...

gispzjz and zyb are participating in a contest, with $n$ referees awarding scores(according to their performance, usually) to them. For each contestant, each referee should name an integer in the interval $[1,h]$ as the score, and the final score of the contestant is the sum over all scores he gets after eliminating $s$ highest scores and $t$ lowest scores.

As one of the referees, you had a bet on gispzjz, so you want him to win this contest, but you also don't want this to look too obvious. Suppose you know the other $n-1$ referees have awarded scores $a_1,\dots,a_{n-1}$ to gispzjz and $b_1,\dots,b_{n-1}$ to zyb. You need to give out your scores $a_n$ and $b_n$ so that the final score of gispzjz is strictly higher than zyb. If that's achievable, you also need to minimize $a_n-b_n$, conditioned on the final score of gispzjz is strictly higher than zyb.
输入解释
The first line contains a number $T(1\leq T\leq 12000)$, denoting the number of test cases.

The first line of each test case contains four integers $n,s,t,h(1\leq n\leq 10^5, 0\leq s,t \leq n-1, 1\leq h \leq 10^9)$, denoting the number of referees, the number of highest and lowest scores that need to be eliminated, and the scoring range for referees, respectively. It is guaranteed that $s+t\leq n-1$.

Then one line containing $n-1$ integers $a_1,...,a_{n-1}(1\leq a_i\leq h)$ follow, denoting the scores already awarded to gispzjz.

Then another line containing $n-1$ integers $b_1,...,b_{n-1}(1\leq b_i\leq h)$ follow, denoting the scores already awarded to zyb.

It is guaranteed that $\sum n\leq 10^6$ over all test cases.
输出解释
For each test case, if it's possible to make gispzjz's score strictly higher than zyb, then output the minimized $a_n-b_n$ in one line, otherwise output "IMPOSSIBLE"(without quotes) in one line.
输入样例
3
3 1 1 4
1 3
2 4
4 1 1 9
4 4 5
4 5 5
4 1 1 9
4 5 5
4 4 5
输出样例
1
IMPOSSIBLE
-4

该题目是Virtual Judge题目,来自 杭电HDUOJ

源链接: HDU-7075

最后修改于 2021-10-23T19:11:19+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
4000/2000MS(Java/Others) 262144/262144K(Java/Others)