408185: GYM103048 F Function-Cuber

Memory Limit:512 MB Time Limit:3 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

F. Function-Cubertime limit per test3 secondsmemory limit per test512 megabytesinputstandard inputoutputstandard output

Since Cuber QQ is a man of character, he himself prepared an interactive problem for this contest. The task is to guess a sequence based on the results of a specific function, called Function-Cuber.

To demonstrate how Function-Cuber works, let's assume that there is a sequence $$$a$$$ of length $$$n$$$. Function-Cuber $$$f_{cb}(a)$$$ is defined as sum of products of every pair of adjacent elements. i.e., $$$f_{cb}(a)=\sum_{i=1}^{n-1} a_ia_{i+1}$$$.

Though sequence $$$a$$$ is unknown, you can get of the output of $$$f_{cb}(a)$$$. However, as you probably have guessed, there are too many possibilities of $$$a$$$, and it is impossible to enumerate and check every of them.

Therefore, Cuber QQ defines another sequence transformation function $$$\text{M}(a,u,v)$$$ ($$$u\ne v$$$), that generates a sequence $$$a'$$$, which has the same length of $$$a$$$, and its values are:

$$$$$$ a'_i=\begin{cases} a_i+1 & i=u\\ a_i-1 & i=v\\ a_i & \text{Otherwise} \end{cases} $$$$$$

Note that this function will not actually change $$$a$$$. It will just generate another sequence $$$a'$$$.

Now Cuber QQ can answer you $$$f_{cb}(\textrm{M}(a, u, v))$$$ for any $$$u$$$ and $$$v$$$ you have given.

Input

The interaction starts with reading two integers $$$n$$$ and $$$s$$$ ($$$2\le n\le 10^5,1\le s\le 10^9$$$) — denoting the length of $$$a$$$ and the value of $$$f_{cb}(a)$$$.

It is guaranteed that $$$1\le a_i\le 100$$$ and $$$n$$$ is even.

Interaction

Then you can start interaction. You can make queries like:

  • ? $$$u\quad v$$$  — The program will return the value of $$$f_{cb}(\text{M}(a,u,v))$$$. You should make sure $$$1\le u,v\le n,u\ne v$$$.
  • ! $$$a_1\,a_2 \ldots a_n$$$  — The program will judge you output and finish interaction.

You can ask at most $$$n+25$$$ queries.

It is guaranteed that there is a unique solution to this problem.

After printing any query do not forget to print end of line and flush the output. Otherwise, you might get Idleness limit exceeded. To do this, use:

  • fflush(stdout) or cout.flush() in C++;
  • System.out.flush() in Java;
  • flush(output) in Pascal;
  • stdout.flush() in Python;
  • see the documentation for other languages.
ExampleInput
4 20

17

17
Output
? 1 2

? 2 3

! 1 2 3 4
Note

Note that the example interaction contains extra empty lines so that it's easier to read. The real interaction doesn't contain any empty lines and you shouldn't print any extra empty lines as well.

加入题单

算法标签: