Help Lost Robot!
All submissions for this problem are available.
Robot Bunny is lost. It wants to reach its home as soon as possible. Currently it is standing at coordinates (x1, y1) in 2-D plane. Its home is at coordinates (x2, y2). Bunny is extremely worried. Please help it by giving a command by telling the direction in which it should to go so as to reach its home. If you give it a direction, it will keep moving in that direction till it reaches its home. There are four possible directions you can give as command - "left", "right", "up", "down". It might be possible that you can't instruct the robot in such a way that it reaches its home. In that case, output "sad".
First line of the input contains an integer T denoting the number of test cases. T test cases follow.
First line of each test case contains four space separated integers x1, y1, x2, y2.
For each test case, output a single line containing "left" or "right" or "up" or "down" or "sad" (without quotes).
- 1 ≤ T ≤ 5000
- 0 ≤ x1, y1, x2, y2. ≤ 100
- It's guaranteed that the initial position of robot is not his home.
Input 3 0 0 1 0 0 0 0 1 0 0 1 1 Output: right up sad
Test case 1. If you give Bunny the command to move to the right, it will reach its home.
|Time Limit:||2 sec|
|Source Limit:||50000 Bytes|
|Languages:||C, CPP14, JAVA, PYTH, PYTH 3.6|
Fetching successful submissions
If you are still having problems, see a sample solution here.