Problem AK
Going to Seed
The Great Seedling is a mythical spirit that supposedly rewards whoever catches it with farm crops that remain in bloom forever. Rumor has it that in the dead of tonight, it will be coming to Sweet Apple Acres—the Apple family’s farm!
![\includegraphics[width=0.43\textwidth ]{TBO_Apples.png}](/problems/goingtoseed/file/statement/en/img-0001.png)
Applejack and Apple Bloom are hoping to catch the Great Seedling to help out with their massive harvest this season. They’ve decided to stake out the farm and keep close watch over the trees; they’re going to see if they can sense the Great Seedling’s movements. Now, catching the Great Seedling is no easy feat, and they’ve only got one shot—if the Great Seedling becomes aware that it’s being hunted, it will flee and will never be found again!
There are
In one half-hour, Applejack and Apple Bloom can each choose a consecutive range of trees, and they will intently observe that range of trees. The Great Seedling is restless and so sometime within this half-hour, it will spring from its current tree to an adjacent one. It does this very sneakily, but as it lands it will cause the leaves of the new tree, and only this tree, to rustle.
At the end of the half-hour, Applejack and Apple Bloom will then each report whether they sensed a rustle among the leaves of the trees they were intently observing. Unfortunately, because the Great Seedling’s movement is very subtle, they won’t be able to determine exactly which tree’s leaves rustled; however, we can assume that they are paying close enough attention that they will never make a mistake.
Once they are sure which tree the Great Seedling is in, they can quickly rush there to capture it; the Great Seedling will not have time to react. However, they only have one attempt—because they will be making a lot of noise, if they choose the wrong tree, the Great Seedling will flee, and all will be for naught.
There are only
Interaction
First, your program should read a single integer
Then, we repeat the following process:
-
Your program writes a single line to the standard output in either format:
-
( ; ), meaning that for the next half-hour, Applejack should observe all the trees with labels from to , inclusive, and Applebloom should observe the trees with labels from to , inclusive. Note that these ranges can overlap, and in particular they can even be the same range. This can be done at most times. -
( ), meaning that you are sure that the Great Seedling is in tree and they should rush to capture it immediately.
-
-
If your program asks a question, your program should read two integers
and ( ) from standard input. If , it means Applejack did not sense a rustle; if , it means she did. Similarly, if , it means Apple Bloom did not sense a rustle; if , it means she did. -
If your program guesses the answer, your answer will be checked. Your program should terminate immediately after this.
After asking each question, do not forget to output end of line and flush the output. To do this, use:
-
fflush(stdout) or cout.flush() in C++;
-
System.out.flush() in Java;
-
stdout.flush() in Python;
-
see documentation for other languages.
Sample interaction
Your output (standard output) |
Kattis’ answer (standard input) |
Interpretation |
|
There are |
|
|
Applejack should observe the trees |
|
|
Applejack reports sensing a rustle while Apple Bloom does not. |
|
|
Applejack should observe tree |
|
|
Neither reports sensing a rustle. |
|
|
Applejack should observe the trees |
|
|
Both report sensing a rustle. |
|
|
There is now enough information to conclude that the
Great Seedling is behind tree |