CF BUDDY
← Problems·

1520F1 · Guess the K-th Zero (Easy version)

1600 · binary search, interactive

Problem: This is an interactive problem.

This is an easy version of the problem. The difference from the hard version is that in the easy version t=1t=1 and the number of queries is limited to 2020.

Polycarp is playing a computer game. In this game, an array consisting of zeros and ones is hidden. Polycarp wins if he guesses the position of the kk-th zero from the left tt times.

Polycarp can make no more than 2020 requests of the following type:

  • ? ll rr — find out the sum of all elements in positions from ll to rr (1lrn1 \le l \le r \le n) inclusive.

In this (easy version) of the problem, this paragraph doesn't really make sense since t=1t=1 always. To make the game more interesting, each guessed zero turns into one and the game continues on the changed array. More formally, if the position of the kk-th zero was xx, then after Polycarp guesses this position, the xx-th element of the array will be replaced from 00 to 11. Of course, this feature affects something only for t>1t>1.

Help Polycarp win the game.

Note: In the first test, the [1,0,1,1,0,1][1, 0, 1, 1, 0, 1] array is hidden. In this test k=2k=2.

Sample Cases

Case 1

Input

6 1
2

2

1

1

0

0

Output

? 4 6

? 1 1

? 1 2

? 2 2

? 5 5

! 5

Similar problems

00:00:00
Loading editor…
Welcome! I'm your coding tutor for this problem. Use the chips below to reveal stored hints or get AI feedback on your code. I'll guide you step by step — never giving away the solution.

Sign in to unlock AI tutor feedback