创建于 2026/07/18 · 更新于 2026/07/18
This is an interactive problem.
There is a hidden tournament on vertices numbered from to .
A tournament is a directed graph such that for every pair of distinct vertices and , exactly one of the two directed edges and exists.
You may ask the interactor two non-empty disjoint sets of vertices and . The interactor will return the number of directed edges from to .
Your task is to find a set of vertices such that , and for every vertex , there exists a vertex such that is an edge of .
You have to find such a set using no more than queries.
First, read an integer (), denoting the number of test cases.
For each test case, first read an integer (), denoting the number of vertices in the hidden tournament.
It is guaranteed that the sum of over all test cases does not exceed .
The interactor may be adaptive. However, for each test case, all answers are guaranteed to be consistent with at least one tournament on the current vertices.
To ask a query with two non-empty disjoint sets and , output:
Here , all vertices in and must be distinct, and .
Then you should read an integer , denoting the number of ordered pairs such that , , and is an edge of .
For each test case, the number of queries must not exceed .
When you have found a valid set for the current test case, output:
Here .
After outputting the answer, you should continue to the next test case.
1
4
4
? 2 1 2 2 3 4
! 2 1 2