Problem D
GlitchBot

One of our delivery robots is malfunctioning! The job of the robot is simple; it should follow a list of instructions in order to reach a target destination. The list of instructions is originally correct to get the robot to the target. However, something is going wrong as we upload the instructions into the robot’s memory. During the upload, one random instruction from the list takes on a different value than intended. Yes, there is always a single bad instruction in the robot’s memory and it always results in the robot arriving at an incorrect destination as it finishes executing the list of instructions.
The robot can execute the instructions “Left”, “Right”, and
“Forward”. The “Left” and “Right”
instructions do not result in spatial movement but result in a
Given the coordinates of the target destination and the list of instructions that the robot has in its memory, you are to identify a correction to the instructions to help the robot reach the proper destination.
Input
The first line of the input contains the
Output
Identify how to correct the robot’s instructions by printing
the line number (starting at
Sample Input 1 | Sample Output 1 |
---|---|
3 2 11 Forward Right Forward Forward Left Forward Forward Left Forward Right Forward |
8 Right |
Sample Input 2 | Sample Output 2 |
---|---|
-1 1 3 Right Left Forward |
1 Forward |