Технокубок 2021 - Финал
G
Vabank
Codeforces
3200
原题
← FH →
翻译中…

Gustaw is the chief bank manager in a huge bank. He has unlimited access to the database system of the bank, in a few clicks he can move any amount of money from the bank's reserves to his own private account. However, the bank uses some fancy AI fraud detection system that makes stealing more difficult.

翻译中…

Gustaw knows that the anti-fraud system just detects any operation that exceeds some fixed limit $M$ euros and these operations are checked manually by a number of clerks. Thus, any fraud operation exceeding this limit is detected, while any smaller operation gets unnoticed.

翻译中…

Gustaw doesn't know the limit $M$ and wants to find it out. In one operation, he can choose some integer $X$ and try to move $X$ euros from the bank's reserves to his own account. Then, the following happens.

翻译中…
  • If $X \le M$, the operation is unnoticed and Gustaw's account balance raises by $X$ euros.
  • Otherwise, if $X \gt M$, the fraud is detected and cancelled. Moreover, Gustaw has to pay $X$ euros from his own account as a fine. If he has less than $X$ euros on the account, he is fired and taken to the police.
翻译中…

Initially Gustaw has $1$ euro on his account. Help him find the exact value of $M$ in no more than $105$ operations without getting him fired.

翻译中…

Input

翻译中…

Each test contains multiple test cases. The first line contains the number of test cases $t$ ($1 \le t \le 1000$).

翻译中…

For each test case, there is no input prior to your first query, but you can be sure that $M$ is integer, and $0 \le M \le 10^{14}$.

翻译中…

Output

翻译中…

For each test case, when you know the exact value of $M$, print a single line with format "! $M$". After that your program should proceed to the next test case or terminate, if it is the last one.

翻译中…

Interaction

翻译中…

When you want to make an operation, print a single line with format "? $X$", denoting that you try to move $X$ euros ($1 \le X \le 10^{14}$). As a response, read a single line that can take the following values:

翻译中…
  • "Lucky!", if $X \le M$. Your balance raises by $X$.
  • "Fraudster!", if $X \gt M$. Your balance decreases by $X$.
  • "Fired!", if $X \gt M$, but you can't pay $X$ euros of fine. In this case your program must terminate immediately. You also get this response if you exceed the number of queries.
翻译中…

You can make at most $105$ such queries in each test case.

翻译中…

After printing a query do not forget to output end of line and flush the output. Otherwise, you will get Idleness limit exceeded. To do this, use:

翻译中…
  • fflush(stdout) or cout.flush() in C++;
  • System.out.flush() in Java;
  • flush(output) in Pascal;
  • stdout.flush() in Python;
  • see documentation for other languages.
翻译中…

Hacks

翻译中…

To make a hack, prepare an input in the following format.

翻译中…

The first line contains a single integer $t$ ($1 \le t \le 1000$) — the number of test cases.

翻译中…

Each test case is described with a line containing a single integer $M$ ($0 \le M \le 10^{14}$).

翻译中…

Note

翻译中…

In the example $M = 5$, so the operation with $X = 6$ is detected. At this moment, Gustaw's balance is $16$ euros, so he just pays fine.

翻译中…

样例

Input #1
1

Lucky!

Lucky!

Lucky!

Lucky!

Lucky!

Fraudster!
Output #1
? 1

? 2

? 3

? 4

? 5

? 6

! 5
InputCopy OutputCopy
题目信息
题号
1482G
时间限制
2 s
内存限制
256 MB
标签
二分
交互题

题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。