1 Description
You will write a program that simulates a Tetris-like game, SKKU-tris. Instead of the seven
blocks in the original version, SKKU-tris uses the following 8 types of blocks identified by a
number (from 1 to 8):
Like Tetris:
· The game board of SKKU-tris is 20 blocks tall (20 rows) and 10 blocks wide (10
columns), having 200 cells in total.
· A block falls from the top of the board, and it stops when it touches the bottom of the
board or lands on another block that has been placed before it.
· A completed line disappears. When a line is removed, the blocks above it move downward
by one cell.
Unlike Tetris:
· Blocks do not rotate in SKKU-tris.
· Blocks do not move left or right in SKKU-tris.
· There is no “game over”. It is guaranteed that the given blocks can be contained in the
board, without overflow, if completed lines are appropriately removed.
Given a sequence of blocks (block type and column number), write a program that prints
the final state of the board.
1
College of Computing and Informatics, Sungkyunkwan University
2 Input
6
1 0
3 1
4 5
5 8
8 3
7 0
On line 1, the number of blocks, N, is given (1 ≤ N ≤ 50).
On the following N lines, the type (ti) and column number (ci) of the i-th
block are given. ti
is an integer ranging from 1 to 8. ci
is an integer ranging from
0 to 9 that is the column number on which the leftmost cells of the block are
located.
There is no “invalid” input. For example, ti and ci are always in range. Blocks
never spill over the board vertically if you remove completed lines accordingly.
Blocks also never spill over the board horizontally; for example, block type 4
spans 3 cells horizontally, so if ti = 4, it is guaranteed that ci
is less than or equal
to 7. In any case not described in this document, the behavior of your program is undefined.
3 Output
Print out the final state of the board. Print 1 for a cell that is occupied and 0 for an empty
cell. Do not print an empty space between the cells on the same row. Print one line break
after each row.
0000000000
0000000000
0000000000
0000000000
0000000000
0000000000
0000000000
0000000000
0000000000
0000000000
0000000000
0000000000
0000000000
0000000000
0000000000
1010000000
0100000000
1010000000
1000100000
1111110011
Output Explanation
Below is the state of the board after placing each block in the input except for that last one.
Note that you need to print out the final state only.
2
College of Computing and Informatics, Sungkyunkwan University
Block 1 0 3 1 4 5 5 8 8 3
State
0000000000
0000000000
0000000000
0000000000
0000000000
0000000000
0000000000
0000000000
0000000000
0000000000
0000000000
0000000000
0000000000
0000000000
0000000000
0000000000
0000000000
1000000000
1000000000
1100000000
0000000000
0000000000
0000000000
0000000000
0000000000
0000000000
0000000000
0000000000
0000000000
0000000000
0000000000
0000000000
0000000000
0000000000
0000000000
0000000000
0000000000
1000000000
1110000000
1111000000
0000000000
0000000000
0000000000
0000000000
0000000000
0000000000
0000000000
0000000000
0000000000
0000000000
0000000000
0000000000
0000000000
0000000000
0000000000
0000000000
0000000000
1000000000
1110000000
1111011100
0000000000
0000000000
0000000000
0000000000
0000000000
0000000000
0000000000
0000000000
0000000000
0000000000
0000000000
0000000000
0000000000
0000000000
0000000000
0000000000
0000000000
1000000000
1110000011
1111011111
0000000000
0000000000
0000000000
0000000000
0000000000
0000000000
0000000000
0000000000
0000000000
0000000000
0000000000
0000000000
0000000000
0000000000
0000000000
0000000000
0000000000
0000000000
1000100000
1111110011