Hide

Problem B
Aww Man

/problems/awwman/file/statement/en/img-0001.png
A charging creeper! AWWW MANNNNN!

You need a total of $T$ different rare materials that can only be found in the deepest caves of the rarest biome at very specific times of the year. The materials are very important to you, so you want to make sure that nothing bad happens. Thus, you want to make a plan.

For each material, you’ve picked out a day on which you’ll embark on the mining trip. Each day during this season is $N$ seconds long (surprisingly, the length of the days is different for different seasons), and the last $M$ seconds of each day are dangerous, as the sun sets and some evil beings can spawn. Being a disciplined and organized person, you’ve also planned out the trip: you wake up at the $a^{th}$ second of the day (starts from 1) and start off the trip, you arrive in the cave and start looking for the material at the $b^{th}$ second of a day (this may or may not be the same day), and it takes $d$ seconds for you to find and collect the material. After getting the material, you head back home along the same path, taking the same amount of time as when you came.

Everything is perfectly planned out, except for one last detail to take care of: the last thing you want is to come home and accidentally run into a creeper and blow up your precious material–or even worse, blow up your house! Under the sun, you can see them clearly, so you know how to avoid them, but at night, you need to be very vigilant. Can you determine whether you’ll arrive home during the day or at night?

Input

The first line of the input contains a single integer $T$ , the number of different materials. ($1 \leq T \leq 100\, 000$)
Then follow $2T$ lines describing the mining trips, with two lines per trip.
The first line of each mining trip contains two space-separated integers: the number of seconds in a day $2 \leq N \leq 10^{18}$ and the length of nighttime $1 \leq M < N $.
The second line of each mining trip contains three space-separated integers: $a$, $b$, and $d$ ($1 \leq a,b,d \leq N$).

Output

For each mining trip, output one line containing “YES” (without the quotes) if you will return during daytime and “NO” (without the quotes) otherwise.

Sample Input 1 Sample Output 1
1
7 2
1 2 3
NO
Sample Input 2 Sample Output 2
1
7 2
1 2 1
YES

Please log in to submit a solution to this problem

Log in