No.934 Explosive energy drink
Problem Statement
In the year $20XX$, it became a hot topic that mixing certain $K$ types of energy drinks causes an explosion.
However, neither which specific $K$ types of energy drinks explode when mixed, nor the value of $K$, is known.
So the job given to $Iot$ is to identify the $K$ types of energy drinks.
Here there are $N$ types $(K\le N)$ of energy drinks, with an infinite number of bottles of each.
The energy drink types are numbered from $1$ to $N$.
If even one of the specific $K$ types of energy drinks is not mixed in, there is no explosion.
Disregarding the amount required for an explosion, identify them on behalf of $Iot$.
However, you may ask the following question
- When energy drinks ${a_1,a_2...a_M}$ (where $a_i=1,2,...N$, any one of these values / $2\le M\le N$) are mixed, do they explode?
Input and Output
First, the number of types of energy drinks prepared, $N(3\le N\le 1000)$, is given from standard input as follows.$N$Then, your program may make up to $1333$ question queries to standard output in the following format.
$?\ M$ $a_1\ a_2\ ...a_M$This output represents asking whether mixing the $M$ energy drinks ${a_1,a_2,...a_M}$ causes an explosion. $M$ must be an integer satisfying $2\le M\le N$.
Also, ${a_1,a_2,...a_M}$ must be sorted in ascending order and printed separated by spaces.
After you make a question query, its answer is given from standard input in the following format.
$ans$If mixing the $M$ energy drinks causes an explosion, $ans=1$; if it does not, $ans=0$.
Finally, you must output the answer in the following format.
$!\ K$ $b_1\ b_2\ ...b_K$First, $K$ represents the number of types of energy drinks that explode when mixed. Then, ${b_1,b_2,...b_K}$ represent the numbers of the energy drinks that explode when mixed.
They must be sorted in ascending order and printed separated by spaces.
Notes
- After each output, you must flush standard output.
- After a question query, be sure to receive its result.
- After outputting the answer, your program must terminate immediately.
- It is guaranteed that the answer can always be determined with at most $1333$ queries.
- It is guaranteed that the $N$ types of energy drinks always include the $K$ types of explosive energy drinks.
- It is guaranteed that $2\le K$.
Sample
Sample 1
Input
3 0 1 0 1
Output
? 2 1 2 ? 2 2 3 ? 2 1 3 ? 3 1 2 3 ! 2 2 3
- Mixing energy drink 1 and energy drink 2 does not cause an explosion, so $ans=0$.
- Mixing energy drink 2 and energy drink 3 causes an explosion, so $ans=1$.
- Mixing energy drink 1 and energy drink 3 does not cause an explosion, so $ans=0$.
- Mixing energy drink 1, energy drink 2, and energy drink 3 causes an explosion, so $ans=1$.
Here is an example of incorrect input and output for the same case.
Input
3 0 1 0
Output
? 2 1 2 ? 2 2 3 ? 2 1 3 ? 3 1 3 2In the $4$th query, $a_i$ is not in ascending order, so it is judged as WA.
提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。
leafirby
QCFium