#P9721. [EC Final 2022] Inversion
[EC Final 2022] Inversion
题目描述
There is a hidden permutation of . You want to find it by asking the parity of the number of inversions of .
You can query in the format , and the interactor will respond you $\left( \sum_{l\leq i < j\leq r} [p_i > p_j]\right) \bmod 2$. is when and when .>
输入格式
Firstly, you should read the integer ().
After that, you can make no more than queries. To make a query, output ``'' () on a separate line, then you should read the response from standard input.
To give your answer, print ``'' on a separate line. The output of the answer is \textbf{not} counted towards the limit of queries.
After that, your program should terminate.
After printing a query, do not forget to output end of line and flush the output. To do this, use or in C++, in Java, in Pascal, or in Python.
It is guaranteed that the permutation is fixed in advance.
3
0
0
1
? 1 2
? 1 3
? 2 3
! 2 3 1