#P7824. 「RdOI R3」毒水
「RdOI R3」毒水
Description
This is an interactive IO problem.
You have bottles of water in front of you, numbered from to . Exactly bottle is poisoned. You can use some lab mice to determine which bottle is poisoned.
However, among the mice you find, there is one and only one mutant mouse. If it drinks poisoned water, it will not die. Otherwise, it will die within seconds. All other mice will die within seconds if they drink poisoned water; otherwise, they will not die.
You need to find the poisoned bottle within one minute. Since testing has already taken seconds, your program can only run for second.
Interaction
First, read two integers , from standard input, representing the number of water bottles and the maximum number of mice you are allowed to use.
If you need mice, print lines to standard output. Except for the last line, each line has the format: 1 m B1 B2 ... Bm, meaning you take one mouse and let it drink the water from these bottles: bottle , bottle , , bottle . Finally, print one line: 2, then flush the output buffer, meaning you do not need more mice.
Below are buffer flushing operations for some languages:
- C++:
fflush(stdout)orcout.flush(). - C:
fflush(stdout). - Java:
System.out.flush(). - Python:
stdout.flush(). - Pascal:
flush(output). - Other languages: please refer to the documentation of the corresponding language.
Of course, if , the interactor will return WA, RE, UKE, or TLE, and you will get points for that test.
Then read integers from standard input, where . If , it means the -th mouse has died; otherwise, it means the -th mouse is still alive.
Finally, print one integer to standard output, indicating the index of the poisoned bottle.
Input Format
See Interaction.
Output Format
See Interaction.
4 12
1 0 1 1 1 1 1 1 1 0 1 1
1 1 1
1 1 2
1 1 3
1 1 4
1 1 1
1 1 2
1 1 3
1 1 4
1 1 1
1 1 2
1 1 3
1 1 4
2
2
Hint
Sample Explanation
The poisoned bottle is , and both the -nd and the -th times the mouse was made to drink bottle , so the results returned for these two operations are . For the other operations, since the mice did not drink the poisoned water, the returned result is .
The sample is only for understanding the interaction and may not be logically consistent.
Constraints
This problem uses bundled tests.
Note: there is no subtask that contains all other subtasks.
| subtask | score | ||
|---|---|---|---|
Notes
Only when you send operation 2 to the interactor will it tell you the answers to your previous operation 1. In other words, you cannot get the return result immediately after performing a single operation 1.
Translated by ChatGPT 5
京公网安备 11011102002149号