#P12399. 「FAOI-R9」少年游
「FAOI-R9」少年游
Description
Mingyue has thought of an integer sequence of length , which has already been determined. For each index , holds.
Mingyue has only told the value of to Qingfeng, and he can ask up to queries. In each query, Qingfeng picks an interval (which must satisfy ), then Mingyue will multiply by for each . After the multiplications are processed, Mingyue will tell Qingfeng the current Greatest Subsegment Sum of the array . Note that the queries are permanent.
Qingfeng can only make one answer, in which he must recover the initial array . Suppose you are Qingfeng, please finish the game.
: The Greatest Subsegment Sum of an array is defined as the maximum value of the sum of any subsegment (possibly, an empty subsegment) of .
Interaction
To ask a question, output a line in the following format:
- — to pick an interval and query. You should guarantee that .
The jury will output a single integer denoting the current Greatest Subsegment Sum, after processing your query.
When you have determined the initial array, output a line in the following format:
- . You should guarantee that .
After printing a query, do not forget to output the end of the line and flush the output. Otherwise, you will get an arbitrary verdict except Accepted. To do this, use:
fflush(stdout)for C/C++;std::cout << std::flushfor C++;System.out.flush()for Java;stdout.flush()for Python;flush(output)for Pascal;- see the documentation for other languages.
Specially, the output will be automatically flushed if you use std::endl to print an end-of-line, for C++.
Input Format
Each test contains multiple test cases. The first line contains the number of test cases . The description of the test cases follows.
The first line of each test case contains a single integer — the length of the array .
After reading , you should interact with the jury with respect to the Interaction section above.
- If the initial value of is reported wrong, or you have exceeded the limit of queries, the jury immediately terminates and you will receive points.
- Otherwise, if this is the last test case, the jury terminates you will receive points according to the maximum number of queries you have made in each test case.
- Otherwise, the interaction continues.
Output Format
Refer to the Interaction and Input section above.
1
5
3
2
? 1 3
? 1 3
! 1 -1 0 2 -2
Hint
Sample Description
Note that the example test cases do not represent an optimal strategy for asking questions and are only shown for the sake of demonstrating the interaction format. Specifically, we cannot uniquely determine the initial array in the examples.
Constraints
Subtasks are used in this problem.
- Subtask 1 (20 pts): .
- Subtask 2 (80 pts): No additional constraints.
For each test data, it's guaranteed that , , , and the interactor is not adaptive (that means the initial value of has already been determined before all the queries).
Scoring
A Subtask has a positive score (before rounding to integers) if and only if in all test cases, the answers are correct and the number of queries made for each test case does not exceed .
Denote the maximum number of queries in all the test cases in a subtask as . Then the rate of score of the Subtask is calculated as follows:
- , if ;
- , if ;
- , if .
Postscript
"I hope that, in the future, there will always be someone who can tolerate your fragility and listen to your words."
"The breeze of spring, sprung up in your mind, will never be alone."
京公网安备 11011102002149号