14618 - Caillou's Tetris game (class)   

Description

CSSA's most handsome president Chang Cailou recently felt that riding motorcycles outdoors was too boring, so he developed a special Tetris game and would like you to help him test this game.

 

The special Tetris game screen has 10 rows and 15 columns. Every second, a block will fall until it reaches the bottom or rests on another stationary block.

When all cells in a row are filled with stationary blocks, that row will be eliminated, and all blocks above will move down one row.

The game lasts for T seconds, during which 1 to N blocks will be placed. Each block will be placed into the game at a designated time point M, consisting of a 3x3 grid with its top-left corner at coordinates (X, Y) and identified by block type P. All blocks are guaranteed to have sufficient space for placement without exceeding game boundaries.

The K-th placed block is labeled with its placement order number K, where 0 indicates no block at the current position. Output the game screen at the time the game ends.

There are six types of block:

  1. IBlock
    K00
    K00
    K00
  2. JBlock
    KK0
    0K0
    0K0
  3. LBlock
    K00
    K00
    KK0
  4. SBlock
    0KK
    KK0
    000
  5. TBlock
    KKK
    0K0
    000
  6. OBlock
    K00
    000
    000

This problem is a partial judge.
Please implement functions defined in the header file.

All classes that inherit from Tetrominoes

  • draw: place the block onto the scene

Scene

  • Scene: constructor
  • ~Scene: destructor
  • update: Update the game state to reflect the situation at P-th second.
  • checkBlock: Check whether the block is a stationary block.
  • checkRow: Check whether the row needs to be eliminated.
  • eliminate: Eliminate the row.
  • print: Print the game screen.

Input

The first line contains three integers N, T, indicating N blocks will be placed during the game and the game lasts for T seconds.

The next N lines contain four integers M, Pi , X, Y, indicating the i-th block will be placed at Mi seconds into the game, in a 3×3 grid with top-left corner at coordinates (X, Y. Each placed block is guaranteed to have enough space for placement. The integer Pi indicates the block type.

Constraints

  • 1 ≤ T ≤ 500
  • 1 ≤ N, M ≤ T
  • 1 ≤ P ≤ 6
  • 1 ≤ X ≤ 10
  • 1 ≤ Y ≤ 15

Subtasks

  • Testcases 1 ~ 3: N = 1
  • Testcases 4 ~ 6: No elimination operation
  • Testcases 7 ~ 9: No additional restrictions

Output

The K-th placed block is labeled with its placement order number K, where 0 indicates no block at the current position. Output the game screen at the time the game ends.

 

Please remember to print "\n" at the end.

Sample Input  Download

Sample Output  Download

Partial Judge Code

14618.cpp

Partial Judge Header

14618.h

Tags




Discuss