Codeforces Round 897 (Div. 2) |
---|
Finished |
This is the simple version of the problem. The only difference between the versions is the limit on the number of queries. In this version, you can make no more than 100 queries. You can make hacks only if both versions of the problem are solved.
This is an interactive problem!
salyg1n has given you a positive integer $$$k$$$ and wants to play a game with you. He has chosen an array of $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$1 \leq a_i \leq 10^9$$$). You must print $$$a_1 \oplus a_2 \oplus \ldots \oplus a_n$$$, where $$$\oplus$$$ denotes the bitwise XOR operation. You can make queries of the following type:
You can make no more than $$$100$$$ queries to answer the problem.
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 1000$$$) – the number of test cases.
The interaction between your program and the jury's program begins with reading two positive even integers $$$n$$$ and $$$k$$$ ($$$1 \leq k \leq n \leq k^2 \leq 2500$$$) – the length of the chosen array and the length of the query subarray, respectively.
To find the value of $$$a_i \oplus a_{i + 1} \oplus \ldots \oplus a_{i + k - 1}$$$, print the query in the format $$$?$$$ $$$i$$$ ($$$1 \leq i \leq n - k + 1$$$). Then read a single integer – the answer to your query.
You can make no more than $$$100$$$ queries. When you are ready to print the answer, output it in the format $$$!$$$ $$$x$$$. After that, proceed to process the next test case or terminate the program if it was the last test case. Printing the answer does not count as one of the $$$100$$$ queries.
If your program makes more than $$$100$$$ queries for one set of input data, or makes an invalid query, then the response to the query will be -1. After receiving such a response, your program should immediately terminate to receive the verdict Wrong Answer. Otherwise, it may receive any other verdict.
After printing a query do not forget to output the end of line and flush the output. Otherwise, you will get Idleness limit exceeded. To do this, use:
Hacks:
To perform a hack, use the following format:
The first line contains a single integer $$$t$$$ – the number of test cases.
The description of each test case should consist of two lines. The first line contains the numbers $$$n$$$ and $$$k$$$ – the length of the chosen array and the length of the query subarray, respectively. The second line contains $$$n$$$ numbers $$$a_1, a_2, \ldots, a_n$$$ – the array that the jury should choose for this test case.
2 4 2 6 4 6 6 4
? 1 ? 3 ! 2 ? 1 ! 4
In the first test case, the jury has chosen the array $$$a$$$ $$$=$$$ $$$[4, 2, 5, 1]$$$
In the second test case, the jury has chosen the array $$$a$$$ $$$=$$$ $$$[5, 7, 1, 3, 3, 7]$$$
Name |
---|