There is a hidden permutation $$$P$$$ of $$$\{1, 2, \ldots n\}$$$. In one query, you can output a permutation $$$Q$$$ of $$$\{1, 2, \ldots n\}$$$ and in return get the value:
$$$$$$ \sum_{i=1}^{n} |P_i - Q_i| $$$$$$
You can ask at most $$$1300$$$ queries. Recover the permutation $$$P$$$.
First, read an integer $$$n$$$ ($$$1 \leq n \leq 1000$$$). Then, you can output a permutation $$$Q$$$ of $$$\{1, 2, \ldots n\}$$$ at most $$$1301$$$ times (It is $$$1301$$$ instead of $$$1300$$$ because the last query is not counted, as you will see later). The judge returns its sum of absolute differences when compared with $$$P$$$.
The judge returns with an ok verdict when $$$Q = P$$$ (or equivalently, the return value is $$$0$$$). Else, if $$$Q$$$ is never equal to $$$P$$$, you get a wrong answer verdict.
4 4 6 0
1 2 3 4 2 3 4 1 2 3 1 4