#P8849. 『JROI-7』hibernal

    ID: 9534 远端评测题 1000ms 128MiB 尝试: 0 已通过: 0 难度: 7 上传者: 标签>洛谷原创交互题Special Judge洛谷月赛

『JROI-7』hibernal

Background

I do not really know why I want to tell this story. I also do not quite understand what clowns have to do with chefs, but since at this moment they are arranged on my draft paper (see the attached picture), I can only try to talk about it.

Uh, you are right. I really cannot think of any relationship between them.

Well, the clown appears here probably mostly because he always shows up with something strange.

But I still think the role of a chef is interesting.

But, but, what does this have to do with "hibernal" ?

Ah, let us talk about the chef instead. Ingredients are still interesting.

Hey, actually vegetables can provide a much richer texture than meat, but it seems everyone disagrees with my view. What about you?

Add a space between English letters and Chinese characters. Let me check.

[AI drawing] girl, naked back, neck fetish.

Ah, I got it. This seems like it could be an interesting story. Hmm, writing it might take a lot of time, so you should pass this problem first and then come urge me qwq.

Should I say something at the end to be polite? Then I wish everyone good health. Yay!

Problem Description

There are nn apples. The ii-th apple is labeled ii. Exactly 22 of them are golden apples.

In each query, you can divide the nn apples into two sets S1,S2S_1, S_2, and each apple must belong to exactly one set.

Let xx be the number of golden apples in S1S_1, and yy be the number of golden apples in S2S_2. The interactive judge will return the value of x×yx \times y.

Please find the labels of the two golden apples within at most 1919 queries.

The interactive judge is adaptive, meaning the labels of the two golden apples may change as queries are made, but they will always satisfy all queries that have already happened (see the sample).

Input Format

This problem has multiple test cases. The first line contains a positive integer TT, the number of test cases. The next TT lines each contain a positive integer nn, the number of apples in this test case.

This problem uses interactive I/O.

Interaction Format

  • ? k a1 a2 a3 ... ak Put these kk apples into one set, and put the other nkn-k apples into the other set. The interactive judge will return an integer xx as the answer. You must ensure 0<k<n0<k<n.
  • ! x y Output the answer. You must ensure x<yx<y.

Note: In each test case, the total number of the first type of operations must not exceed 1919.

Also note that after each operation, you need to call the following function to flush the output buffer:

  • For C/C++: fflush(stdout);
  • For C++: std::cout << std::flush;
  • For Java: System.out.flush();
  • For Python: stdout.flush();
  • For Pascal: flush(output);

For other languages, please check the corresponding documentation.

Output Format

See "Interaction Format".

1
5

1

0




? 3 1 2 3

? 2 2 4

! 1 5

Hint

The sample is only for understanding the interaction process and may not be logically consistent.

[Sample Explanation]

Initially, the two golden apples are 3,53,5.

In the first query, each set has 11 golden apple, so the judge returns 11, and the labels of the golden apples do not change.

In the second query, one set has 22 golden apples and the other set has none, so the judge returns 00. Then the two golden apples change from 3,53,5 to 1,51,5. It is easy to see that although the labels of the golden apples changed, the answers to the first two queries are still satisfied.

You answer 1,51,5, the answer is correct, and the interaction ends.


Constraints

Score n=n= T=T=
1010 22 200200
1818
6464
2020 512512
5050 10001000

Scoring

For each testdata, among the 200200 test cases, take the one with the maximum number of queries. If it exceeds 1919 queries, the score is 00. Otherwise, you get full score.

The interactive judge is guaranteed to run within 0.1 s under normal conditions.

If your output is invalid, TLE/WA and other results may occur.

Translated by ChatGPT 5