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

建议使用的浏览器:

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

7182:Fall with Full Star

题目描述
Fall loves playing games and collecting strange achievements in games. If he doesn't pass a level with full stars, he will feel uncomfortable.

Today, Fall is playing a new game. The game includes $n$ levels without order, which means you can play the levels in any order. However, each level can only be challenged once. During the challenge, Fall may get hurt or pick up rare items. Assuming that before he challenges level $i$, he has power $x$, and after he challenges this level, his power will be increased by $d_i$. After that, if his power is higher than or equal to $s_i$, he will get a full star in this level.

Initially, Fall has power $s_0$ , he wants to find a challenge order that he can get full star levels as more as possible.

输入解释
The first line contains a single integer T ($1\leq T \leq 20$), the number of test cases. For each test case:

The first line contains two integers $n,s_0(1\leq n\leq 1\times 10^5,\sum{n}\leq 10^6, |s_0|\leq 10^{14})$.

The $i$-th line of the next $n$ lines contains two integers $d_i,s_i(|d_i|\leq 10^9,|s_i|\leq 10^{14})$, representing the information about the $i$-th level.
输出解释
For each test case, output a single line containing one integer -- the maximum number of full star levels that Fall can get in a single line.
输入样例
1
3 0
4 5
2 5
1 100
输出样例
2

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

源链接: HDU-7182

最后修改于 2022-09-15T06:17:12+00:00 由爬虫自动更新

共提交 0

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