DWITE '09 R4 #3 - Moving at the same time

View as PDF

Submit solution

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

Problem type
DWITE Online Computer Programming Contest, January 2010, Problem 3

Silly title, but this is exactly what this question addresses. There are too many questions on the CompSci.ca forums asking just that — "I have 2 (or more) characters in my game, how do I move them both at the same time?" This should be obvious to some, and might sound more complicated than it is to others. Maybe the constraints of this question will provide a clue?

The input will contain 5 lines, each line will describe a game field and characters on it. The size of the field is the size of the line, 1 \le N \le 20. Periods are empty spaces, while integers 0 \le C \le 3 are Characters. The value of the integer represents that character's speed, in the direction to the right of where they are. Once the character leaves the field, we are no longer concerned with that character. If two characters end up on the same spot, represent them as a sum of their velocities. In the initial input, all of the characters are distinct, and it is guaranteed that the overlapping sum is never greater than 9.

The judge is the observer of the game. Each output line is judge's perception of the game (that is, each output line is a frame of this game's FPS (frames per second)). If a character's velocity is 2, then in time from one frame to the next, that character moves 2 spots to the right.

The output will contain 5 sets of 5 lines each, the snapshots of the game field for each game as it progresses, starting with the input, and following with 4 frames.

Sample Input

.2..1......
2.0..

Sample Output

.2..1......
...2.1.....
.....21....
.......3...
........12.
2.0..
..2..
..0.2
..0..
..0..

Problem Resource: DWITE

Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported

Comments


  • 18
    bruce  commented on May 4, 2019, 1:52 a.m.

    In the initial input, the characters may not be distinct.