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

建议使用的浏览器:

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

7180:Climb Stairs

题目描述
DLee came to a new level. What is waiting for him is a tall building with $n$ floors, with a monster on each stair, the $i$-th of which has health point $a_i$.

DLee starts from the ground(which can be regarded as the 0-th floor), with a base attacking point $a_0$. He can choose to jump $1,2,\dots,k$ floors up or walk $1$ floor down, but he cannot go to floors whose monster has a health point strictly greater than his attacking point, nor can he go to floors which had been visited. Once he comes and defeats a monster he can absorb his health point and add it to his attacking point.

Note that DLee should always be on floors $\{0,1,2,3,\dots,n\}$.

Now DLee asks you whether it is possible to defeat all the monsters and pass the level.
输入解释
There are $T$ test cases.

In each test case, the first line contains three integers: $n,a_0,k(1\leq n,k\leq 10^5,1\leq a_0\leq 10^9)$, representing the number of floors, base attacking point, and the maximum number of floors that DLee can jump.

The second line contains $n$ integers $a_1,\dots,a_n(1\leq a_i\leq 10^9)$, representing the health point of each monster.

The sum of $n$ does not exceed $10^6$.
输出解释
For each test case, output "YES" or "NO" to show whether it's possible to defeat all monsters.
输入样例
4
6 1 4
2 2 1 1 9 3
4 2 2
2 3 8 1
3 1 2
3 1 2
7 2 3
4 3 2 7 20 20 20
输出样例
YES
YES
NO
NO

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

源链接: HDU-7180

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

共提交 0

通过率 --%
时间上限 内存上限
3000/1500MS(Java/Others) 524288/524288K(Java/Others)