Say No To Drugs solution codechef- There are NN people participating in a race. The NthNth participant is your friend, so you want him to win. You are not a man of ethics, so you decided to inject some units of a Performance Enhancement Drug (don’t ask where that came from) in your friend’s body.

For Solution

Click Here!

There are NN people participating in a race. The NthNth participant is your friend, so you want him to win. You are not a man of ethics, so you decided to inject some units of a Performance Enhancement Drug (don’t ask where that came from) in your friend’s body.

  • From the charts, you came to know the speed of every player. Formally, for a player ii, his speed is denoted by SiSi.
  • The change in speed with one unit of the drug is KK units. Note that KK can be negative, which means the drug has more side effects than benefits.
  • Of course, there will be a drug test before the race, so your friend will be caught if the number of units of the drug in his blood is greater than or equal to LL. Say No To Drugs solution codechef

You need to determine whether you can help your friend to win the race (with or without drugs), without getting caught.

Note: A player wins the race if he has the maximum speed among all the participants. If there are more than one people with a maximal speed, they tie at first place, and no one wins!

Input Format Say No To Drugs solution codechef

  • First line will contain a single integer TT, the number of test cases. Description of the test cases follows.
  • First line of each test case will contain three space-separated integers, NN – the number of participants, KK – the change in speed with one unit of the drug, and LL – minimum units of the drug that can be detected in the drug test.
  • Second line of each test case will contain NN space-separated integers SiSi, the speeds of the participants.

Output Format Say No To Drugs solution codechef

For each test case print “Yes” if you can help your friend to win the race, otherwise “No” in a single line.

Constraints

  • 1≤T≤2001≤T≤200
  • 1≤N,L≤10001≤N,L≤1000
  • −1000≤K≤1000−1000≤K≤1000
  • 1≤Si≤10001≤Si≤1000

Sample Input 1

3
4 2 2
2 1 3 2
4 2 2
2 1 4 2
3 -10 100
12 11 9

Sample Output 1

Yes
No
No

Explanation

  • In test case 11, initial speeds are {2,1,3,2}{2,1,3,2}. You can inject 11 unit of the drug into your friend’s body, and increase his speed from 22 to 44. 44 is the fastest speed, thus you helped your friend win the race. Hence, the answer is “Yes”.
  • In test case 22, initial speeds are {2,1,4,2}{2,1,4,2}. You can inject 11 unit of the drug into your friend’s body, and increase his speed from 22 to 44. But you can not inject any more units of the drug, and with speed 44 your friend can only tie at rank 11 and not Win. Hence, the answer is “No”.
  • In test case 33, initial speeds are {12,11,9}{12,11,9}. Note that the impact of the drug in this case is negative, which means that the speed will only decrease if you inject it. So, there is no way you can help your friend to win. Hence, the answer is “No”.

 

For Solution

Click Here!

Check Also

Who’s Opposite? solution codeforces

Who’s Opposite? solution codeforces Some number of people (this number is even) have stood in …

Leave a Reply

Your email address will not be published. Required fields are marked *