#4977. Bad Juice
Bad Juice
Bad Juice
题目描述
This is an interactive problem (a type of problem where your program interacts with the judge program through Standard Input and Output). There are bottles of juice, numbered to . It has been discovered that exactly one of these bottles has gone bad. Even a small sip of the spoiled juice will cause stomach upset the next day. Takahashi must identify the spoiled juice by the next day. To do this, he decides to call the minimum necessary number of friends and serve them some of the bottles of juice. He can give any number of bottles to each friend, and each bottle of juice can be given to any number of friends. Print the number of friends to call and how to distribute the juice, then receive information on whether each friend has an upset stomach the next day, and print the spoiled bottle's number.
输入格式
输出格式
提示
is an integer. This is an interactive problem (a type of problem where your program interacts with the judge program through Standard Input and Output). Before the interaction, the judge secretly selects an integer between and as the spoiled bottle's number. The value of is not given to you. Also, the value of may change during the interaction as long as it is consistent with the constraints and previous outputs. First, the judge will give you as input.
You should print the number of friends to call, , followed by a newline.
Next, you should perform the following procedure to print outputs. For , the -th output should contain the number of bottles of juice you will serve to the -th friend, and the bottles' numbers in ascending order, , separated by spaces, followed by a newline.
Then, the judge will inform you whether each friend has a stomach upset the next day by giving you a string of length consisting of and .
For , the -th friend has a stomach upset if and only if the -th character of is . You should respond by printing the number of the spoiled juice bottle , followed by a newline.
Then, terminate the program immediately. If the you printed is the minimum necessary number of friends to identify the spoiled juice out of the bottles, and the you printed matches the spoiled bottle's number , then your program is considered correct.Each output should end with a newline and flushing Standard Output. Otherwise, you may receive a TLE verdict. The verdict is indeterminate if your program prints an invalid output during the interaction or terminates prematurely. In particular, note that if a runtime error occurs during the execution of the program, the verdict may be WA or TLE instead of RE. Terminate the program immediately after printing . Otherwise, the verdict is indeterminate. The judge for this problem is adaptive, meaning that the value of may change as long as it is consistent with the constraints and previous outputs.Below is an interaction with .
| Input | Output | Description |
|---|---|---|
| $3$ | The number of bottles, $N$, is given. | |
| $2$ | Print the number of friends to call, $M$. | |
| $2 1 2$ | Serve juice $1$ and juice $2$ to the first friend. | |
| $1 2$ | Serve juice $2$ to the second friend. | |
| $10$ | The string $S$ is given, indicating whether each friend has a stomach upset the next day. | |
| $1$ | Print the spoiled bottle's number. | |