14606 - Caillou's Tetris game II   

Description

CSSA's most handsome president Chang Cailou is also a perfectionist. He has developed a new game mode for his special Tetris game, and hopes you can help him test this new mode.

 

In the new mode, the special Tetris game screen has 8 rows and 9 columns. Every second, a block will fall until it reaches the bottom or rests on another stationary block.

Initially, there will be some stationary blocks. Then a block will be placed, consisting of a 3x3 grid, with (X, Y) being the coordinates of the top-left corner. It is guaranteed that there is enough empty space for the block to be placed.

After placement, K operations will be performed.

  • L: moving left
  • R: moving right
  • D: continuing downward without any horizontal movement

If a movement would cause collision with a stationary block or go beyond the game screen, the move is illegal and should be ignored. The block will not become stationary.

Finally, output the game screen after K operations.

  • '*' represents the placed block
  • '#' represents stationary blocks that have stopped
  • '.' represents position where no block has appeared yet

 

For sample input (RLRR):

     

     

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

  • update: Update the game state after each operation.
  • moveBlock: Executes horizontal movement operations.

Input

Initially, there is an 8x9 two-dimensional array representing the initial game screen.

The next line contains two integers X, Y, indicating the coordinates (X, Y) of the top-left corner of the 3x3 grid where a block will be placed.

Following this is a 3×3 grid using '*' to represent cells with blocks and '.' to represent empty cells, showing the block's shape. Each placed block is guaranteed not to split.

The last line contains an integer K, representing the number of operations.
The next K lines each contain one operation: 

  • L: moving left
  • R: moving right
  • D: continuing downward without any horizontal movement

Constraints

  • 1 ≤ K, X ≤ 8
  • 1 ≤ Y ≤ 9

Subtasks

  • Testcases 1 ~ 2: Only D operation
  • Testcases 3 ~ 4: No need to ignore any operations
  • Testcases 5 ~ 6: No additional restrictions

Output

Output the game screen after K operations:

  • L: moving left
  • R: moving right
  • D: continuing downward without any horizontal movement

Sample Input  Download

Sample Output  Download

Partial Judge Code

14606.cpp

Partial Judge Header

14606.h

Tags




Discuss