luogu#P7848. 「JZOI-2」填问卷
「JZOI-2」填问卷
Background
All the members are thinking about organizing the anniversary celebration, but Xiao Xi just wants to slack off.
So Xiao Xi opened his favorite game.
Problem Description
After playing this game for so long, today Xiao Xi wants to join an event and fill out a questionnaire to see how well he understands the game.
There are a total of true/false questions on the questionnaire. Poor Xiao Xi found that he cannot do a single question, so he decided to ask his teammate for help.
His teammate is a veteran user of the game and can do all the questions, so Xiao Xi decided to ask the teammate for assistance. Specifically, each time Xiao Xi will ask in the following format:
int ask(int m,vector<int> w,vector<bool> ans)
Here, indicates the total number of questions in this query, indicates the question number of the -th queried question (you need to ensure that in a single query the are all distinct, since the teammate is very impatient), and indicates the answer that Xiao Xi believes is correct for the -th question (). The teammate will tell him how many questions he got correct in this query.
For example, suppose there are three questions and the answers are . If Xiao Xi calls ask(2,[1,3],[1,1]), then the return value is , because question 1 is answered incorrectly and question 3 is answered correctly.
Because there are too many questions, Xiao Xi needs you to write a program to help him obtain the correct answers to all questions.
You do not need to implement the main function. You only need to implement vector<bool> work(int n). The return value should be the answers to questions . Note that vector<bool> is 0-indexed, so you need to shift your answer array left by 1 position.
Of course, querying is tiring, so Xiao Xi hopes the number of queries is as small as possible. The scoring standard for the number of queries is given in the Hint. Also, although there is no limit on the number of questions in a single query, you should still be careful: if you query too many questions at once, you may get TLE. The problem guarantees that the time complexity of each query is .
For convenience, use to represent a correct choice and to represent an incorrect choice.
Input Format
The sample data belongs to the first part and is given in the following format:
where indicates the correct answer to question .
Output Format
The following shows the error messages from grader.cpp:
- Some in the query is greater than or less than .
- Duplicate appears in the query.
- does not match the length of or .
- The answers are wrong or the returned array format is incorrect.
After that, grader.cpp will return your number of queries.
3
0 0 1
2
Hint
Sample Explanation
One feasible plan with queries is shown below.
ask(1,[2],0), the return value is , indicating that the answer to question 2 is .
ask(2,[1,3],[0,1]), the return value is , maybe because the luck is too good and you guessed everything right, so we can conclude that the answers to questions 1 and 3 are .
So you can return , and the number of queries is .
Of course, if the result of the second query is , then you cannot directly determine the answers. So, guessing has risks.
Constraints
For all testdata, it is guaranteed that .
To ensure the quality of users' answers and to prevent users from guessing all true/false questions correctly, the questionnaire creator will carefully construct the answer to each question.
Of course, it is guaranteed here that the answers already exist after the questionnaire is made, and they will not be constructed based on your queries.
Assume that for each testdata you made queries. The scoring standard is given below. | Range of | Score | | :----------: | :----------: | | | | | | | | | $\min(90,\lfloor\frac{2^{17}-Q}{2^{16}}\times100\rfloor)$ | | | | | | |
Note that this problem has multiple test points, and your final score is the minimum score among all testdata.
Implementation details: be sure to add extern "C". You may choose to fill in the functions in problem.cpp, or implement them yourself. When compiling, directly compile and run grader.cpp.
Friendly reminder: if your random approach performs too poorly, even if your number of queries is less than , your score may still be less than .
Translated by ChatGPT 5