#K10831. Pillar Crossing

    ID: 23334 Type: Default 1000ms 256MiB

Pillar Crossing

Pillar Crossing

Jenish is standing at the first of a series of pillars and wants to cross to the last one. He can jump from his current pillar to any of the next d pillars. The energy cost for jumping from the ith pillar to the jth pillar is given by \( |h_i - h_j| \), where \( h_i \) and \( h_j \) denote the heights of the respective pillars. Given Jenish's energy limit \( E \), determine if it is possible for him to reach the last pillar without exceeding his available energy.

inputFormat

The input begins with a single integer \( T \) (the number of test cases). Each test case consists of two lines: the first line contains three integers \( n \), \( d \), and \( E \), where \( n \) is the number of pillars, \( d \) is the maximum jump distance (i.e. Jenish can jump from pillar \( i \) to any pillar \( j \) such that \( 1 \leq j-i \leq d \)), and \( E \) is the total energy available. The second line contains \( n \) space-separated integers representing the heights \( h_1, h_2, \ldots, h_n \) of the pillars.

outputFormat

For each test case, output a single line with either "YES" if Jenish can cross from the first pillar to the last pillar without exceeding his energy limit, or "NO" otherwise.

## sample
1
2 1 0
1 2
NO

</p>