The combination lock to Josh's locker requires a sequence of
Josh allows you to make up to
Let
Can you successfully find Josh's sequence?
Constraints
All integers in Josh's sequence are greater than
If you find Josh's sequence correctly, with the maximum possible value of
If you find Josh's sequence correctly, but do not maximise the value of
Otherwise, you will score
Interaction
This is an interactive problem, where the interactor is adaptive.
At first, you should read in a single integer on a single line, representing the value of
Then, you will have the opportunity to make up to ? l r
. Then, you should read in a single integer on a single line, representing the bitwise XOR of all elements from the
Finally, once you have made all of your queries, you should output a line in the form ! a_1, a_2, ..., a_N
, where
If at any point you format your queries incorrectly, or ask more than
If you successfully guess the correct sequence, then you will receive an Accepted verdict for that test case. Your final score for the problem will be equal to the minimum percentage of points received for any test case.
Please note that you may need to flush stdout
after each operation, or interaction may halt. In C++, this can be done with fflush(stdout)
or cout << flush
(depending on whether you use printf
or cout
). In Java, this can be done with System.out.flush()
. In Python, you can use sys.stdout.flush()
.
Sample Interaction
>>>
denotes your output. Do not print this out.
3
>>> ? 1 2
5
>> ? 1 3
0
>> ? 2 3
1
>> ! 1 4 5
Explanation
Josh's sequence is the sequence
For the first query, the bitwise XOR of the elements between the
For the second query, the bitwise XOR of the elements between the
For the third query, the bitwise XOR of the elements between the
Here,
The sequence has been correctly guessed, with
Comments
I'm getting presentation error, can't wrap my head around what's wrong, the given sample and the samples that I came up with work fine. Can someone help? UPD. It was my formatting, I'm dumb.