|시간 제한||메모리 제한||제출||정답||맞은 사람||정답 비율|
|2 초||512 MB||4||3||3||75.000%|
As you may know, the popular computer game “Tetris” was invented by Russian programmer Alexey Pajitnov. In this problem you need to write program which plays a simplified version of this game.
The playing field is a rectangular vertical shaft, called the “well”. Random figures of unit square blocks appear on top of the wall, the player chooses the horizontal position and rotation of the figure, after that the figure falls down in the well. The objective of the game is to create horizontal lines filled without gaps. When such a line is created, it disappears, and any blocks above the deleted line fall.
In this version of the game, the well size units, and there are only three types of figures:
You lose if at some point there are five non-empty lines of the well. You win if you hadn't lost after n figures have fallen.
You need to write program which plays the game described above and wins regardless of which figures will appear.
You should implement four functions (methods):
void init(int n). This function is called before any other function.
void new_figure(int figure_type). This function is called when a new figure appears.
figure_typeis a number from 1 to 3, indicating the type of the figure according to the table above.
int get_position(). This function should return a number from 0 to 2, the position of the leftmost block of the last figure.
int get_rotation(). This function should return a number from 0 to 3, the number of time the figure was rotated couter-clockwise.
get_rotation will be called only after
The grader makes the following function calls:
init(3). There will be three figures.
new_figure(1). A figure of type 1 falls from the top of the well.
get_position()returns 0. This means that player wants to put the figure in the leftmost column.
get_rotation()returns 1 (or 3). This means that player wants to rotate the figure vertically.
get_rotation()returns 0 (or 2).
In all subtasks n ≤ 1000.
All figures have type 1.
All figures have type 2.
All figures have type 1 or 2.
All figures have type 3.
Figures can have different types.
The sample grader reads the input in the following format:
C++17, C++14, C++20, C++14 (Clang), C++17 (Clang), C++20 (Clang)