시간 제한메모리 제한제출정답맞힌 사람정답 비율
0.3 초 (추가 시간 없음) 256 MB71111029.412%

문제

Linda likes to change her hair color from time to time, and would be pleased if her boyfriend Archie would notice the difference between the previous and the new color. Archie always comments on Linda’s hair color if and only if he notices a difference—so Linda always knows whether Archie has spotted the difference or not.

There is a new hair dye series in the market where all available colors are numbered by integers from 1 to N such that a smaller difference of the numerical values also means less visual difference.

Linda assumes that for these series there should be some critical color difference C (1 ≤ C ≤ N) for which Archie will notice color difference between the current color colornew and the previous color colorprev if |colornew − colorprev| ≥ C and will not if |colornew − colorprev| < C.

Now she has bought N sets of hair dye from the new series—one for each of the colors from 1 to N, and is ready to set up an experiment. Linda will change her hair color on a regular basis and will observe Archie’s reaction—whether he will notice the color change or not. Since for the proper dye each set should be used completely, each hair color can be obtained no more than once.

Before the experiment, Linda was using a dye from a different series which is not compatible with the new one, so for the clearness of the experiment Archie’s reaction to the first used color is meaningless.

Her aim is to find the precise value of C in a limited number of dyes. Write a program which finds the value of C by experimenting with the given N colors and observing Archie’s reactions to color changes.

프로토콜

This is an interactive task. At the beginning the input contains a single integer—the value of N (1 < N ≤ 1018). The value of C is kept secret by the grading system.

Then your program should make queries writing output in the following format: “? P”, where P is an integer (1 ≤ P ≤ N) denoting the next color used. For each query the grading system gives an answer in the next line of the input. The answer is 1 if Archie notices the color difference between the last two colors and 0 otherwise. No two queries should have the same P value.

When your program determines C, it should output its value in the following format: “= C” and stop the execution. The grading system will not respond to this output and will not accept further queries.

Your program may use at most 64 queries “?” to find the correct value of C.

서브태스크

번호배점제한
19

N ≤ 64

213

N ≤ 125

321

N ≤ 1000

424

N ≤ 109

533

No further constraints

예제 입력 1

7

1

1

0

0

1

예제 출력 1


? 2

? 7

? 4

? 1

? 5

= 4

채점 및 기타 정보

  • 예제는 채점하지 않는다.