|시간 제한||메모리 제한||제출||정답||맞은 사람||정답 비율|
|2 초||512 MB||1||1||1||100.000%|
At work, you sort $100$ boxes per hour. Each box has one of three colours: red, blue, or green. The boxes come through a slot, so you cannot see what boxes have yet to come. You want to take as many boxes home as possible, but you only have two bins to store them in. Unfortunately, although the bins are not limited in capacity, you absolutely cannot have two boxes of different colours be in the same bin.
Thankfully, a coworker told you the distribution of the box colours but forgot to specify the colours. All you have are three integers that add up to $100$. When you receive a box, you can do three things. First, you can choose to empty either bin you have, discarding all boxes inside it. After that, you can place the box into a bin that is either empty or contains only boxes of the specified colour. Alternatively, you can simply discard the current box.
You suspect that these boxes are valuable, so you want to keep as many as possible. You will work for $T = 100$ hours in total, collecting boxes. Each hour, you start with two empty boxes. Can you collect at least $43$ out of $100$ boxes at the end of each hour?
In each test, the order of the boxes is not random in any way: it is fixed in advance, before the start of the contest.
First you will get a line with an integer $T$, the number of hours you will work. For all tests in this problem, $T = 100$.
For each hour you work, you will receive a line with three integers: $A$, $B$, and $C$, indicating that there are $A$ boxes of some colour, $B$ boxes of another colour, and $C$ of the remaining colour. It is guaranteed that $0 \le A, B, C \le 100$ and $A + B + C = 100$.
Then, you will start your hour of work. You will be given a line with a single character, one of "
G", or "
B", indicating the colour of the current box. Then you may empty either bin, with "
EMPTY 1" or "
EMPTY 2". You may empty either bin as many times as you'd like. Then, either output "
PLACE $x$" where $x$ is the bin to place the box into, or output "
DISCARD" to discard the current box. In any case, after printing each line, remember to output a newline character and flush the output.
If at any point you output an invalid instruction or put two boxes of different colours in one bin, you will receive a line with a single integer,
-1. At this point, your program should terminate, and you will then get the outcome "
1 5 2 3 G G B B G G R G B R
PLACE 2 PLACE 1 EMPTY 1 PLACE 1 EMPTY 2 EMPTY 1 PLACE 2 DISCARD DISCARD PLACE 1 DISCARD PLACE 2 PLACE 1
The sample interaction shows a valid exchange, but does not comply with the constraints, as it has $T = 1$ and $A + B + C = 10$. It will not appear in any of the test cases.