CF1200B Block Adventure

题目描述

你在玩一个游戏,已知在你面前有$n$列砖块,你的背包中有$m$个砖块,第$i$列有$h_i$个砖块。 在第$i$列你可以进行下列操作 - 如果你的背包中有砖块,你可以将将背包中的砖块放在第$i$列。 - 如果第$i$列有砖块,你可以捡起来,放在背包中。 - 如果第$i$列和第$i+1$列的高度差少于或等于$k$个砖块,你可以从第$i$列跳到第$i+1$列。 问你是否能从第一列从第$1$列跳到第$n$列。 如果能,输出$YES$,如果不能,输出$NO$。。

输入格式

### 多组测试数据 第一行输入组数${T}(1{\le}T{\le}1000)$。 #### 对于每组测试数据 第一行输入$n,m,k({1{\le}n{\le}100},{0{\le}m{\le}10^6},{0{\le}k{\le}10^6})$。 第二行输入$n$个数,第$i$个数代表$h_i$。

输出格式

对于每组数据,输出$YES$或$NO$。

说明/提示

In the first case, Gildong can take one block from the $ 1 $ -st column, move to the $ 2 $ -nd column, put the block on the $ 2 $ -nd column, then move to the $ 3 $ -rd column. In the second case, Gildong has to put the block in his bag on the $ 1 $ -st column to get to the $ 2 $ -nd column. But it is impossible to get to the $ 3 $ -rd column because $ |h_2 - h_3| = 3 > k $ and there is no way to decrease the gap. In the fifth case, the character is already on the $ n $ -th column from the start so the game is won instantly.