next up previous
Next: Sample Interaction Up: Twelve CoinsOne Counterfeit Previous: Twelve CoinsOne Counterfeit

Interaction

This is a new experiment in programming contests. In conventional problems, you are given the complete input data at once, and you have the freedom to read all data before solving the problem (although to save memory, you usually don't). Not any more in this problem, as that would make no sense. Your program is supposed to output which coins to weigh, then the judge's program will input which side is heavier, and so on. Your program must respond and produce output as soon as possible. To ensure that your output reaches the judge's program immediately, please use the flush commands in your programming language.

Coins are represented by numbers from 0 to 11.

Your program outputs, on a single line, the coins to be weighed. There must be an even number of coins in this line. Each coin can appear at most once. The left half of the coins will be placed on the left side of the balance, and the right half of the coins will be placed on the right side. For example, if you output ``4 8 2 6'', then 4 and 8 will be on the left side, and 2 and 6 will be on the right side. The input will be a single line with the letter ``L'' if the left side is heavier, ``R'' if the right side is heavier, or ``E'' if they have the same weight.

The above can happen for three times or less. At the end, your program must output the answer like this:

heavier 8
which means 8 is the counterfeit coin and is heavier; or
lighter 8
which means 8 is the counterfeit coin and is lighter.

Your program should then terminate.



ACM Programming Contest Account
Mon Feb 5 17:30:22 EST 2001