Who doesn't want to save a mother? Like everyone, Protik was finding a way to earn some money (he has no money right now) so that he can donate. He found an event of hill-climbing which says that the person who will be able to climb to the peak of “Wakanda” hill, will be rewarded with prize money. Protik likes hill-climbing very much and he is on a vacation too. So Protik decided to participate and donate the money which he might get from that event.
The hill is a steep hill and there are rocks (numbered from to ) and to climb to the peak of the hill Protik has to use some or all of those rocks. The heights of all the rocks from the ground are given. The rocks with maximum height among them are at the peak of the hill which means Protik has to reach any of the rocks with maximum height. Protik can grab any rock if the difference between that rock’s height and Protik’s height from the ground is at most and he will always climb upwards. Protik has an initial weight of kg. Each rock has a maximum weight capacity that it can hold which means if Protik’s weight is greater than the rock’s weight capacity, then he can not use that rock to climb. Each rock also has a magical power . After reaching rock, his weight will become , ( can be both negative and positive integer) and he will continue with this weight. After this weight change, if his weight becomes greater than that rock’s weight capacity, he will still be able to stay on that rock. Initially, Protik is on the ground and when he is on any rock, the rock’s height from the ground will be his height from the ground.
Protik doesn't have much time. He needs to be sure that he can climb to the peak of the hill otherwise he will need to find another way of earning some money. So he needs your help because you are a good programmer. You have to tell him whether he can climb to the peak of the hill or not.
The first line of the input consists an integer , the number of test cases.
First line of each test case contains space separated integers , and .
The next lines contains space separated integers.
, height of each rock from ground.
, maximum weight capacity of each rock.
, magical power of each rock.
It is guaranteed that sum of over all test cases will not exceed .
Print YES if Protik can win the event otherwise print NO. You can print YES /NO in any case. For example, "Yes", "yes", "YES", etc are equivalent.
2 3 5 10 3 6 10 12 10 5 3 2 1 4 5 10 3 8 13 17 5 5 4 3 -5 2 -2 2
0% Solution Ratio
Login to submit