DWITE '10 R1 #2 - Robot Vacuum Prototype

View as PDF

Submit solution

Points: 3
Time limit: 2.0s
Memory limit: 64M

Problem type
DWITE Online Computer Programming Contest, October 2010, Problem 2

How hard can it possibly be to put together a robot vacuum? Some gears, some motors, and it can all be controlled by an iPhone. Easy, done! Now, to test if this thing actually works… You find a narrow hallway to safely run experiments in; it looks something like this:

.*...

There are 5 spaces, marked by periods. Your robot, marked by an asterisk, starts out somewhere in this hallway, and can move left or right. Once it reaches either end, further attempts to move in that direction keep it in the same spot.

The input will contain 5 test cases. The first line will be a map, followed by 5 lines of directions – either L to move left, or R to move right.

The output will contain 5 lines, a map of the hallway with the final position of the robot after executing the instructions.

Sample Input

*....
R
R
R
R
L
.*...
L
L
L
L
L

Sample Output

...*.
*....

Problem Resource: DWITE

Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported

Comments

There are no comments at the moment.