Hide

Problem F
Staying Onsides

It’s the $2018$ Champions League final, the pinnacle of European club soccer, and the two finalist teams are at war for the tournament cup. Real Madrid is coming in hot with a counter-attack for a goal opportunity. Marcelo is about to cross the ball to Gareth Bale, who is sprinting alongside the opponent’s defender, trying to get in position to receive the pass. Bale, however, needs to be careful with not being offsides. Once Marcelo kicks the ball for the pass, Bale can not be ahead of the defender, though being exactly beside the defender makes him safe.
We know the number of seconds before Marcelo passes the ball, $s$, and we can also tell the position $pd$ of the defender and $pb$ of Bale, both in meters away from the end line. On top of that, we also have the defender’s constant speed $sd$ and Bale’s constant speed $sb$, both in meters/second. However, though the defender is running straight towards the goal in a $90^{\circ }$ angle from the right sideline, Bale is coming in at an angle from the right sideline, $a$. Will Bale be offsides?

Input

The first line contains the integer $N$, the number of scenarios/test cases given, where ($1 \leq N \leq 10$).
Each test case is composed of three lines.
The first test case line contains two space-separated integers, $s$, the number of seconds, where ($1 \leq s \leq 5$), and $a$, the angle of Bale’s run, where ($45 \leq a \leq 135$).
The second test case line contains two space-separated integers denoting the $pd$ and the $sd$ of the defender, where ($30 \leq pd \leq 60$) and ($1 \leq sd \leq 10$).
The third test case line contains two space-separated integers denoting the $pb$ and the $sb$ of Bale, where ($30 \leq pb \leq 60$) and ($1 \leq sb \leq 10$).

Output

For each test case, print out YES if Bale will be ahead of the defender (offsides) at the time of the pass. Print out NO if he will not.

Sample Input 1 Sample Output 1
1
2 45
30 2
30 2
NO

Please log in to submit a solution to this problem

Log in