Guess the permutation
Given a permutation of numbers, where is a power of two, you need to determine the order of the elements in this permutation. The permutation is a sequence of integers from to , each appearing exactly once. For example, , , and are valid permutations, while , , and are not.
You can make queries using an array of length , where each element satisfies . Note that does not have to be a permutation. For each query, you receive an array of length , constructed as follows:
c = array of length n filled with zeros for i = 1 to n: if p[a[i]] > p[i]: c[a[i]] += 1 return c
Your task is to find the hidden permutation . The maximum number of queries allowed is specified in the "Scoring" section.
Input
The first line contains two integers and () — the number of test cases and the maximum number of queries allowed per test case.
Interaction
For each test case, read an integer () — the number of elements in permutation . It is guaranteed that is a power of two.
To make a query, output "1 ..." (). In response, the system will return the array , formatted as " ...".
After outputting a query, ensure you print a newline character and flush the output buffer to avoid a "Time Limit Exceeded" verdict. Use:
fflush(stdout)
orcout.flush()
in C++;System.out.flush()
in Java;flush(output)
in Pascal;stdout.flush()
in Python;
Refer to the documentation for other languages.
If your query is invalid (exceeding the query limit or violating input constraints), the system will output "-1" and terminate. If you receive "-1", terminate your program immediately to avoid an arbitrary verdict.
Once you determine the permutation , output "2 ...". If it is the last test case, terminate your program; otherwise, proceed to the next test case.
Examples
1 256 4 0 1 1 1
1 3 2 4 2 2 1 4 2 3
Note
From the first query, we deduced that . Thus, the permutation is .
Scoring
The maximum number of queries your program can use is specified as follows:
(3 points)
(7 points)
(8 points)
(14 points)
(20 points)
(up to 48 points) ; Let be the maximum number of queries used in one test case. The score for this test is:
0 points, if ;
points, if ;
48 points, if ;