|
||||||||||
TetrisTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 373 Accepted Submission(s): 80 Problem Description Tetris is a famous puzzle video game.A random sequence of tetrominoes ¡ªshapes composed of four square blocks each¡ªfall down the playing field (a rectangular vertical well). The object of the game is to manipulate these tetrominoes, by moving each one sideways and rotating it by 90 degree units, with the aim of creating a horizontal line of blocks without gaps. When such a line is created, it disappears, and any block above the deleted line will fall. As the game progresses, the tetrominoes fall, and the game ends when the stack of tetrominoes reaches the top of the playing field and no new tetrominoes are able to enter. Here we consider only a simple variation of tetris. The playing field consists of 20 rows and 10 columns. There¡¯re 7 kinds of tetrominoes: Each kind of tetrominoes may have 4 kind of rotation,ie, rotating by 0,90,180,270 degrees.Here is a sample rotation of type 2 Tetromino: We define the initial position of a tetromino in the falling sequences as the leftmost occupied column of the tetromino after rotation. For example,for a type 2 tetromino with 180 degree rotation and a initial position of 3 is just like: After one move down, it will look likes: You will be given a sequence of tetrominoes with their rotation degrees and their initial position.And in this game there is no player manipulating tetrominoes. Once their rotation degree and initial position are determined,the ending of the game is unique. You just simulate as the original Tetris and are required to output the playing field right before the end of game(if the game ends before the end of sequences,you should output the the playing field right before its ends.).Note if there are some horizontal line that are fully covered by blocks,we should first delete such lines then judging the end of game. Input Input contains multiple cases.Test cases are separated by several blank lines. Each test case starts with a integer M(1<=N<=300) ,indicating that there are M tetrominoes in the input sequence.Follow by M lines,each line contains three integers id,degree,pos(1<=id<=7,degree¡Ê{0,90,180,270},1<=pos<=10),as described before.It guarantees that their inputs are legal. Output For each test case, output the playing field right before the end of game.ie,the playing field right before entering the last tetromino.For output,you should add a boarder to the playing field and output the rows in decreasing order,ie first output Row 20, then Row 19 and so on.If a block is occupied ,output ¡°[]¡±,otherwise you should ouput '..' . Output a blank line after each Case.You may refer to the sample output for more details. Sample Input
Sample Output
Source | ||||||||||
|