
ZOJ Problem Set  2651
An archaeologist want to enter the King's Tomb of a pyramid. But there is a very very long corridor known as the Death Corridor which connects the entrance of the pyramid and the King's Tomb. In order to successfully enter the King's Tomb and avoid death, the archaeologist has got an ancient map about this corridor. First, on this map, the corridor is marked with many numbers indicating the position in the corridor. At the middle of the corridor, namely, the position with Index 0, there is a detector. Anyone who comes at the middle of the corridor or passes it will activate the protection system of the corridor. When the protection system is activated, some poisonous arrows will come out from the wall of the corridor and kill the intruder. But the arrows do not come out all the time and altogether, they will follow such rules: Will the archaeologist successfully pass the Death Corridor? He turns to you for help. You are asked to find out whether there is a method to avoid death or the archaeologist is destined to die if he insists on going into the pyramid. Suppose the corridor is long enough and the the archaeologist run fast enough(i.e. he can run any number of unit length to the left or right in one unit time but not come out of the corridor). Input: There are multiple test cases! Each test case possess a line with three integers N,A,B described above(0<A,B<=N<=20000). Output: For each test case, if the archaeologist can successfully pass the Death Corridor, output "Yes" in a line first. Then on the next N lines output how the archaeologist should go from time 0 to time N1. If the archaeologist should go left S unit length at time T, output on the corresponding line "Left S". Similarly, if the archaeologist should go right S unit length at time T, output on the corresponding line "Right S". Else if the archaeologist should stay at the same position, simply output on the corresponding line "Stay". If there are multiple solutions, output any one. But if the archaeologist cannot pass the corridor, just output one line containing "No". Sample Input:2 1 1 3 2 3Sample Output: No Yes Right 2 Left 3 Right 2 Author: ZHOU Yuan Source: ZOJ Monthly, February 2006 