There are N (2≤N≤1000) students in line, name them s_0,s_1,⋯,s_N−1 by their order.
For each student, you have to check whether he/she did the homework or not, and you can ask:
Q1 defined as 0 standing for "Have you finished the homework?" orQ2 defined as 1 standing for "Are you late for the homework?".However, due to the weird culture in the school, if a student has to answer "no" then he/she will hesitate to answer until the class ends. (Of course, you know that this student expressed "no".)
You prepare the questions q_0,q_1,⋯,q_N−1 for the students and they will come to answer in order, and you have to wait for their answers.
Here, for the COVID-19 situation, you write the questions on the computer and upload them online and what you receive is a big YES on the monitor. You can only get the sequence of answers.
However, the online system was broken so the questions get arranged by a pre-chosen order i_0,i_1,⋯,i_N−1.
You can have at most ⌈N+Nlog_2N⌉ classes to ask the questions.
Write a function question:
input parameter: a Student object containing the information of the students' state and the order
⋅.n() returns the number of students; i.e., N
⋅.ask(Q) returns the list of 'YES'’s (need not be a length of N) based on the question list Q
Q1 and Q2['YES' for j in range(M)] where M is the number of YES's: i.e., M = \max\\{m \le N \\,\vert\\, j < m \Longrightarrow s\_j \textrm{ answers } YES on Q[i_j]\\}output: the list of input questions q_0,q_1,⋯,q_N−1 that gets N YES's and the order i_0,i_1,⋯,i_N−1
Assume every student either finished or was late for the homework, and the states do not change as the classes proceed.
Caution: The protected attributes in Student are named differently in the judging code.