Asteroids
Difficulty : Easy
Community success rate: 62%
Approved by codybumba AgathokakologicalBit tuna_in_cream
A higher resolution is required to access the IDE
- 1290
Statement
Goal
You have been tasked with studying a region of space to detect potentially dangerous asteroids.You are given two pictures of the night sky of dimensions W*H, taken at two different times t1 and t2.
For your convenience, asteroids have been marked with capital letters
Using the information contained in those two pictures, determine the position of the asteroids at t3, and output a picture of the same region of the sky.
If necessary, the final coordinates are to be rounded-down (floor).
Asteroids travel at different altitudes (with
If two or more asteroids have the same final coordinates, output only the closest one.
It is guaranteed that all asteroids at t1 will still be present at t2, that no asteroids are hidden in the given pictures, and that there is only one asteroid per altitude.
NB: Because of the flooring operation, it is important that you choose a coordinate system with the origin at the top left corner and the y-axis increasing in the downward direction.
Input
Line 1: five integers separated by a space, W H t1 t2 t3
Next H lines: a row of picture 1 and picture 2, separated by a white space.
Next H lines: a row of picture 1 and picture 2, separated by a white space.
Output
H lines: the state of the sky at t3
Constraints
0<W<=H<=20
0<=t1<t2<=t3<=10000
0<=t1<t2<=t3<=10000
Example
Input
5 5 1 2 3 A.... .A... ..... ..... ..... ..... ..... ..... ..... .....
Output
..A.. ..... ..... ..... .....
A higher resolution is required to access the IDE