Aparna recently created a random number generator and now she wants Harsh to check if it works fine. She gives Harsh an array containing N numbers generated from this random number generator of hers, and two integers K and P. If the given array contains more than or equal to K numbers in the range X-P to X+P (both inclusive) for any integer X, then the random generator fails.
If for any X the generator fails then ultimately it fails.
Help Harsh in determining whether the random generator works well or not.
Input:
The first line contains T indicating the number of test cases.
Second line contains 3 space separated integers N, K and P.
The next line contains N integers generated by the random number generator.
Output:
For each Test Case Print 'YES' if random generator works correctly else print 'NO'. (Quotes for clarity)
Constraints:
1<=T<=10
1<=N<=10^5
1<=K<=N
|Element of array|<=10^9
0<=P<=10^9
Let X be 3 then X-P=1 and X+P=5. The array contains 2 and 4 in the range(1,5) so the generator fails.
Please login to use the editor
You need to be logged in to access the code editor
Loading...
Please wait while we load the editor
Login to unlock the editorial
Please login to use the editor
You need to be logged in to access the code editor
Loading...
Please wait while we load the editor