#P1921C. Sending Messages
Sending Messages
No submission language available for this problem.
Description
Stepan is a very busy person. Today he needs to send messages at moments (). Unfortunately, by the moment , his phone only has units of charge left. At the moment , the phone is turned on.
The phone loses units of charge for each unit of time it is on. Also, at any moment, Stepan can turn off the phone and turn it on later. This action consumes units of energy each time. Consider turning on and off to be instantaneous, so you can turn it on at moment and send a message at the same moment, and vice versa, send a message at moment and turn off the phone at the same moment.
If at any point the charge level drops to (becomes ), it is impossible to send a message at that moment.
Since all messages are very important to Stepan, he wants to know if he can send all the messages without the possibility of charging the phone.
The first line of the input contains a single integer () — the number of test cases. This is followed by the descriptions of the test cases.
The first line of each test case contains four integers , , , and (, ) — the number of messages, the initial phone's charge, the charge consumption per unit of time, and the consumption when turned off and on sequentially.
The second line of each test case contains integers (, ) — the moments at which messages need to be sent.
It is guaranteed that in a test the sum of over all test cases does not exceed .
For each test case, output "YES" if Stepan can send all the messages, and "NO" otherwise.
You can output each letter in any case (lowercase or uppercase). For example, the strings "yEs", "yes", "Yes", and "YES" will be accepted as a positive answer.
Input
The first line of the input contains a single integer () — the number of test cases. This is followed by the descriptions of the test cases.
The first line of each test case contains four integers , , , and (, ) — the number of messages, the initial phone's charge, the charge consumption per unit of time, and the consumption when turned off and on sequentially.
The second line of each test case contains integers (, ) — the moments at which messages need to be sent.
It is guaranteed that in a test the sum of over all test cases does not exceed .
Output
For each test case, output "YES" if Stepan can send all the messages, and "NO" otherwise.
You can output each letter in any case (lowercase or uppercase). For example, the strings "yEs", "yes", "Yes", and "YES" will be accepted as a positive answer.
Note
In the first test case of the example, at moment , the phone's charge is . When sending a message at moment without turning it off, units of charge will be spent. In this case, the charge will drop to and Stepan will not be able to send the message. When turning off and on, the phone's charge will decrease by , so it will not be possible to send the message in this way.
In the third test case of the example, at moment , the phone's charge is . The phone loses unit of charge per unit of time, and when turned off and on, it loses units of charge. To send all messages, the following actions can be taken:
- Turn off the phone at moment and turn it on at moment , after which units of charge will remain;
- send a message at moment ;
- send a message at moment , after which units of charge will remain;
- Turn off the phone at moment and turn it on at moment , after which units of charge will remain;
- send a message at moment ;
- Turn off the phone at moment and turn it on at moment , after which units of charge will remain;
- send a message at moment ;
- Turn off the phone at moment and turn it on at moment , after which unit of charge will remain;
- send a message at moment .
The last (sixth) test set of the example may fail if there is an integer overflow in your solution.