A harder version of the problem can be found here.
With the Christmas season finally over, Santa has decided to let you collect the leftover candy canes from each of his
In order to help you out, Santa has told you the distribution of the candy canes, except he has left out the colours. All he will give you is
Scoring
For this problem, you will NOT be required to pass ANY of the samples in order to receive points.
Your score will depend on the minimum number of candy canes you obtain over all factories. The number of candy canes you obtain is equal to the sum of the number of candy canes in the two bowls when you leave each factory. Let
Score | |
---|---|
Note that a score of Wrong Answer
(with no additional test cases being executed), a score above Partially Accepted
, and a score of Accepted
. The judge will also provide feedback with your verdict for each test case.
Your score for the problem is equal to the minimum score for each test case.
Interaction
The first line contains the integer
For each factory, the first line will contain
You will then interact with the factory. For each of the R
, G
, or B
, followed by a \n
character, indicating that the colour of the candy cane is either red, green, or blue. You will then be allowed to empty the first bowl by outputting EMPTY 1
(followed by a \n
character) or empty the second bowl with EMPTY 2
(followed by a \n
character). You may empty either bowl as many times as you want. When you are ready to place or discard the candy cane, you can output PLACE 1
(followed by a \n
character) to place the candy cane in the first bowl, PLACE 2
(followed by a \n
character) to place the candy cane in the second bowl, or DISCARD
(please do not forget the \n
character) to discard the candy cane in the trash. Remember that at any point in time, each bowl must not contain two candy canes of different colours. You will only receive the colour of the next candy cane after you place or discard the current candy cane. Once you place or discard the last candy cane, you must move on to the next factory.
The order that the candy canes appear on the conveyor belt is fixed beforehand and will not depend on any of your choices to place, discard, or empty.
If at any point you attempt an invalid operation (such as invalid output format, or two candy canes of different colours in the same bowl), -1
will be outputted (followed by a \n
character of course). When this happens, you should terminate your program to avoid reading from a closed input stream, and you will receive a verdict of Wrong Answer
. Otherwise, the verdict may be undefined.
Please note that you may need to flush stdout
after each operation. In C++, this can be done with fflush(stdout)
or cout << flush
(depending on whether you use printf
or cout
). In Java, this can be done with System.out.flush()
. In Python, you can use sys.stdout.flush()
.
Sample Interaction
The sample interaction does not comply with the problem statement and has
>>>
denotes your output. Do not print this out.
1
5 2 3
G
>>> PLACE 2
G
>>> PLACE 1
B
>>> EMPTY 1
>>> PLACE 1
B
>>> EMPTY 2
>>> EMPTY 1
>>> PLACE 2
G
>>> DISCARD
G
>>> DISCARD
R
>>> PLACE 1
G
>>> DISCARD
B
>>> PLACE 2
R
>>> PLACE 1
Sample Explanation
In the end, you can keep
Comments