Interactive Permutation Guessing: Interaction Protocol
Interactive Permutation Guessing: Interaction Protocol
Input
The first line of the standard input contains integer n, the size of the permutation (1 n 40).
Each of the next lines of the standard input contains response to your query the length of the
longest common subsequence of the permutation queried by you and the permutation a.
Output
Each line of the standard output should contain a space-separated list of integers that form a permu-
tation youre querying.
Your can make at most 5n2 queries.
You must flush the standard output after printing each line. You must not print any lines after you
receive the response n, just exit.
Sample Input
4
3
2
2
4
Sample Output
1 2 3 4
1 3 4 2
4 1 2 3
3 1 2 4