Mission3: obelisk's result

Test case 1

Passed

Run time: 0.09 sec

* Test cases are run from 1 in order. If there is a test case that does not pass, the subsequent test case does not run (knockout system)

points

100 pt Tatsu! Do you really want little old me?
Language: Ruby
I know, I need Minami...
Share!

Tatsuya quits his job and decides to plow his energy into developing apps on his own!

Tatsuya breaks off his engagement with Rena and quits his job. He returns home and decided to focus on a smartphone game he was developing. Help him finish the code and complete his app.
A latticed grid consisting of x spaces horizontally and y spaces vertically is gradually filled in with bombs from below. The user taps the bombs to ignite them and blow them up. As shown in the image below, the remaining bombs fall into the spaces created when other bombs explode.
He has coded the app to ignite the bombs, but you still have to compute how the bombs remain on the playfield after others have exploded and dropped.

The actual input starts with a line with space-separated values (0, indicating empty space; 1, indicating bombs; and 2, indicating ignited bombs.
The actual input looks like this:
4 4
1 0 1 0
2 2 2 0
2 2 1 1
1 1 2 2
And the output looks like this:
0 0 0 0
0 0 0 0
1 0 1 0
1 1 1 1
ミッションX

Output the status of the play grid after the bombs have exploded.

Input value

Input is applied in the following format:
x y
t_0_0 t_1_0 t_2_0 ... t_x_0
t_0_1 t_1_1 t_2_1 ... t_x_1
,,,
t_0_y t_1_y t_2_y ... t_x_y

Constraints

The input values have the following constraints for all test cases.
1 ≦ x ≦ 20
1 ≦ y ≦ 20
t is 0 , 1, or 2

Expected output

Output the status of the play grid after the bombs have exploded.
Please add a new line at the end, and do not include any unnecessary characters or empty lines.
Example 1(input)
3 4
1 0 2
1 2 1
1 2 2
1 2 2

Example 1(output)
1 0 0
1 0 0
1 0 0
1 0 1

Example 2(input)
3 5
0 0 0
2 1 0
1 1 1
1 2 1
2 1 2
Example 2(output)
0 0 0
0 0 0
0 1 0
1 1 1
1 1 1

Your session has expired. Please proceed again from the beginning.

Read from the beginning

Our clients

If you register (login) for paiza, you can download wallpapers!

Then user registration (login) can download 5 kinds of wallpaper in paiza!

Wallpaper 1
Wallpaper 2
Wallpaper 3

無料でプログラミングスキルチェックを試してみる(登録は10秒!)
すぐにプログラミング力をはかるスキルチェック問題にチャレンジできます。(想定解答時間20分)

会員登録(無料)

ページの先頭へ戻る