This is an interactive prober There is a hidden ...

创建于:2026年1月24日

使用 GPT-5.2 Thinking 回答 Chat01

问题

17692628581078215910115060282155.jpg17692628581078215910115060282155.jpg

This is an interactive prober

There is a hidden permutation p of size 6.
There is a hidden permutation¹ p of size n.

You can make queries of another permutation q of size n. The interactor will calculate and give you 1 PiLi

Using at most 5 queries, find the hidden permutation p and output it.

† An array a is a permutation of size n if it contains each of the elements 0, 1, 2, ..., η 1 exactly once.

denotes the bitwise XOR operator.

You can make queries of another permutation g of size n. The interactor will calculate and give you ΣΙΑ

Using at most queries, find the hidden permutation p and output it.

An array e is a permutation of size s if it contains each of the elements 0, 1, 2,...,n 1 exactly once denotes the bitwise XOR operator.

Input

Each test contains multiple test cases. The first line contains the number of test cases t (1 << 200). The description of the test cases follows.

The only line of each test case contains a single integer n (1≤ n ≤1000)-the size of the hidden permutation p.

It is guaranteed that the sum of a over all test cases is at most 1000.

Interaction

You can make queries in the following format to query a permutation q, output one line of the form "? q1 qa permutation of size 2). After that, read a single integer - the value of 1 Pi q." (where q isa

To report the hidden permutation as q, output "! 91 92 9n" (where q is a permutation of size 2). Then, the interaction continues with the next test case.

Reporting the answer does not count towards the number of queries made.

Note that you have to use the flush operation right after printing each line otherwise you may get Idleness. Limit Exceeded verdict. For example, in C++ you should use the function fflush(stdout) or cout.flush(), in Java or Kotlin -System.out.flush(), and in Python-sys.stdout.flush().

Example

Example

input

3

#Test case 1

4

0

#Test case 2

3

6

6

2

Test case 3

6

16

output

Test case 1

? 2 0 1 3

! 2 0 1 3

Test case 2

? 0 1 2

? 1 2 0

? 2 1 0

1 2 0 1

#Test case 3

?0 1 2 3 4 5

1 3 1 4 2 5 0
Give C++ code optimized and plag free

分享这个问答