Your friend Terry has
Terry wants to make sure you know enough about the buckets. To prove you know his buckets, you need to determine the capacities of each bucket, each of which is a positive integer not greater than
You complain that you could never guess the capacities, and so he allows you
Can you determine the capacities of Terrys' buckets?
Interaction
This is an interactive problem. The first line of input contains
You will then begin interaction with Terry, using up to E i
(followed by a \n
character), Terry will empty the F i
(followed by a \n
character), Terry will fill the D i j
(followed by a \n
character) with
If you believe you have the correct list of capacities you may output A
followed by a space-separated list of \n
character), representing your guess of the list of capacities in order from the first bucket to the last. You must terminate your program immediately after performing this operation. Note that this operation does not count towards the limit of
For all cases, it is guaranteed that all of the correct numbers in the list are integers in the range
For
If at any point your query is malformed or you exceed the number of available queries, your program will receive -1
and the interactor will terminate. Upon receiving -1
, your program should terminate to avoid an undefined verdict.
If you attempt an invalid operation (such as invalid output format), you will receive a Presentation Error
verdict.
If you exceed the available query limit, you query an invalid bucket, or you output an incorrect final array, you will receive a Wrong Answer
verdict.
Please note that you may need to flush stdout
after each operation, or interaction may halt. 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
>>>
denotes your output. Do not print this out.
The buckets have capacities
3 10
>>> E 1
>>> E 3
>>> D 2 1
2
>>> D 1 2
2
>>> F 1
>>> D 1 3
1
>>> A 2 4 1
Sample Explanation
After our two empty operations, the water levels are
Then we dump from
Finally, we output the correct array.
This interaction would receive an Accepted
verdict, since it correctly guessed the list of capacities and did not exceed the limit of
Comments