시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
---|---|---|---|---|---|
1 초 | 512 MB | 56 | 19 | 16 | 34.043% |
In this problem you have to program a simple AI for the game Tetris. The objective is simple: complete at least one row. More specifically, for the purposes of this problem we play Tetris according to the following modified set of rules:
Figure G.1: The seven tetrominoes in their initial orientations.
Your submission will be interacting with a special program called the grader. This means that the output of your submission is sent to the grader and the output of the grader is sent to the standard input of your submission. This interaction must follow a specific protocol:
The grader repeatedly sends random pieces (see the note below), denoted by one of the uppercase letters {I
, J
, L
, O
, S
, T
, Z
} as in Figure G.1 above. In reply to each piece, your submission must answer with its desired placement, in the following format:
The grader will then rotate and position the piece accordingly and drop it in the desired location.
After sending each placement, you should flush the standard output to ensure that it is sent to the grader. For example, you can use fflush(stdout)
in C++, System.out.flush()
in Java, and sys.stdout.flush()
in Python.
The game ends as soon as your submission successfully completes a row or sends an invalid placement, whichever happens first (if both happen at the same time, the invalid placement takes precedence). A placement is invalid if some part of the piece would have to be placed outside of the playing area, either to the top or to the side.
If your submission completes a row, the grader will send a single character W. Upon receiving this, your submission must terminate with exit code 0 as usual.
Your submission will be accepted if it follows the protocol above and completes a row. If it makes an invalid placement, it will be judged as “Wrong Answer”.
As described above, the sequence of pieces is determined by a bag randomiser. The seed values for this randomiser have been fixed in advance, such that every submission is run on the same piece sequences.
S O T J I W
1 1 2 4 2 2 3 9 0 6
Figure G.2: Illustration of the example interaction.
ICPC > Regionals > Europe > Northwestern European Regional Contest > German Collegiate Programming Contest > GCPC 2019 G번