8516: Climb Stairs

内存限制:128 MB 时间限制:1 S
题面:传统 评测方式:文本比较 上传者:
提交:1 通过:1

题目描述

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 ai.

DLee starts from the ground(which can be regarded as the 0-th floor), with a base attacking point a0. He can choose to jump 1,2,,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,,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,a0,k(1n,k105,1a0109), representing the number of floors, base attacking point, and the maximum number of floors that DLee can jump.

The second line contains n integers a1,,an(1ai109), representing the health point of each monster.

The sum of n does not exceed 106.

输出格式

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