#P14033. 【MX-X20-T7】「FAOI-R7」子集乘积(subset)
【MX-X20-T7】「FAOI-R7」子集乘积(subset)
Description
This is an interactive problem.
There is a 01-string of length . This 01-string is predetermined before you start querying. You can query the interactor at most times, and then determine the value of each digit in the sequence.
You have two types of queries, both of which count toward the number of operations. The formats are as follows:
-
? s: Here is a string of length consisting only of the digits 0 and 1. Then, let and . The interactor will output the value . -
! s: This indicates that you have determined the value of each digit in the sequence. You need to represent the sequence as a 01-string .- If for all , , the interactor will output . If this is the last test case, the judge will give an
Acceptedresult; if it is not the last test case, you need to proceed to the next test case. - Otherwise, the interactor will output .
- Specifically, this operation can be used at most times. If you use it more than times, the judge will give a
Wrong Answerresult.
- If for all , , the interactor will output . If this is the last test case, the judge will give an
Input Format
This problem contains multiple test cases per test point.
The first line contains a non-negative integer , the number of test cases.
For each test case, the first line inputs a positive integer . Then, the interaction proceeds as described in the problem description.
You can use the following statements to flush the buffer:
- For C/C++:
fflush(stdout); - For C++:
std::cout << std::flush; - For Java:
System.out.flush(); - For Python:
stdout.flush(); - For Pascal:
flush(output); - For other languages, please refer to the help documentation of the respective language.
Specifically, for C++, if you use std::endl instead of '\n' when outputting a newline, it will automatically flush the buffer.
Output Format
See the input format.
3
1
1
2
1
0
1
8
0
1
! 0
? 11
! 00
! 01
? 10100001
! 10100001
Hint
Explanation
The sample is only for demonstrating the interaction format and does not guarantee the rationality of the sample output strategy.
This sample has test cases.
For the first test case, . We guess the final string as 0 and get it right on the first try.
For the second test case, . We first query the product of the counts of 0s and 1s at positions and and get . We first guess the final string as 00 and find it is wrong. Then we guess the final string as 01 and find it is correct.
For the third test case, . We first query the product of the counts of 0s and 1s at positions , , and and get . We first guess the final string as 10100001 and find it is correct.
Scoring Criteria
Let be the maximum number of queries you use across all test cases in all test points. Then:
- If , you will get points.
- If , you will get points.
- If , you will get $5 + 90 \times \biggl(1 - \displaystyle\frac{x-385}{1001-385}\biggr)$ points.
- If , you will get points.
Data Range
This problem uses bundled testing.
For all data, it is guaranteed that , .
Translated by DeepSeek V3.1
京公网安备 11011102002149号