#P8541. 「Wdoi-2」死亡之后愈发愉悦
「Wdoi-2」死亡之后愈发愉悦
Background
Falling cherry blossoms do not wait for spring. If you miss this chance, you may have to wait until the spring-to-summer season when wisteria blooms to enjoy the flowers.
But the two of them still have no mood to sit and feast under the cherry trees.
Because unknown floating spirits suddenly appear and disappear in front of them.
Only later did they understand that these unknown spirits drifting around are neither ordinary ghosts nor the vengeful spirits that appeared some time ago.
They are divine spirits. Spirits that should have transcended to become gods.
Generally speaking, divine spirits mostly live in shrines, but in fact they are formless spirits that can be seen everywhere.
These divine spirits leave them very confused.
Extraordinary and intense human desires, thoughts, fears, and emotions are the reason divine spirits appear. Generally, divine spirits rarely harm humans unless there is a strong desire. For example, praying for a good harvest, or asking to ward off disasters and evil, will not create divine spirits...
A small divine spirit guides Reimu and Marisa deep into the underground of Myouren Temple, where they fight an enemy revived after a thousand years. From the Myouren Temple graveyard to the Hall of Dreams Great Mausoleum in the middle of the lotus pond, from wandering dead spirits to the legendary Prince Shoutoku, from desire acceleration to a tiny desire-filled starry sky, everything feels so unbelievable.
"Only after death can one obtain an even more brilliant rebirth."
Problem Description
[This is an interactive problem.]
Let be the smallest perfect square strictly greater than , and let be the largest perfect square less than or equal to . For example, .
A positive integer is "cute" if and only if . For example, are cute positive integers, while are not.
To listen to the small divine spirit's wish, the protagonists need to ask Miko. The small divine spirit has a favorite positive integer . Based on given by Reimu , Miko can ask the small divine spirit, and the small divine spirit can only answer whether is a cute positive integer ().
Please find through appropriate queries.
Input Format
The first line contains a positive integer , the number of test cases. Each test case is independent.
Then, for each test case, you may perform the following two operations:
- : Ask whether is a . Note that must be within . For a valid query, the interactive judge returns a number or , indicating that is / is not a .
- : Report the you have found. If your reported is correct, this test case ends. Note: the report operation is not counted toward the total number of queries.
If the number of your queries exceeds , or is out of range, or the you report is incorrect, the interactive judge returns . In this case, you should terminate your program immediately, otherwise unpredictable errors may occur.
1
1
1
1
1
1
0
0
1
? 0
? 1
? 2
? 3
? 10
? 100
? 233
? 1919810
! 114514
Hint
Sample Explanation
The process in the sample is for reference only.
In the sample, , and it is a (because , and ).
Similarly, are all . But is not a , because , and .
Constraints and Notes
$$\def\arraystretch{1.5} \begin{array}{|c|c|c|c|c|}\hline \textbf{Subtask} & \bm{a\le } & \bm{T\le} & \textbf{Special Property} & \textbf{Points}\\\hline 1 & 100 & 100 & - & 10\\\hline 3 & 10^9 & 2\times 10^3 & - & 20\\\hline 2 & 10^{12} & 2\times 10^3 & \textbf{A} & 30\\\hline 4 & 10^{12} & 2\times 10^3 & - & 40\\\hline \end{array}$$Special Property : It is guaranteed that is a .
For all testdata, it is guaranteed that . In your queries, the value of must be within .
In addition, your score for each test point is also related to the maximum number of queries used on that test point. Specifically, suppose on some test point you perform the query operation a total of times.
- If , you will get of the score for that test point.
- If , you will get of the score for that test point.
- If , you will get of the score for that test point.
- If , you will not get any score for that test point.
Translated by ChatGPT 5