Dimash learned that Mansur wrote something very unpleasant about him to a friend, so he…
- User
Dimash learned that Mansur wrote something very unpleasant about him to a friend, so he decided to find out his password at all costs and discover what exactly he wrote.
Believing in the strength of his password, Mansur stated that his password — is a binary string of length 𝑛 . He is also ready to answer Dimash's questions of the following type:
Dimash says a binary string 𝑡 , and Mansur replies whether it is true that 𝑡 is a substring of his password.
Help Dimash find out the password in no more than 2𝑛 operations; otherwise, Mansur will understand the trick and stop communicating with him.
Input Each test contains multiple test cases. The first line contains the number of test cases 𝑡 (1≤𝑡≤100 ). The description of the test cases follows.
Interaction At the beginning of each test case, first read 𝑛 (1≤𝑛≤100 ) — the size of the binary string. Then proceed to guessing it.
To guess each string 𝑠 , you can make no more than 2𝑛 queries of the following type:
"? t", where 𝑡 is a binary string such that (1≤|𝑡|≤𝑛 ). In response to this query, you will receive 1 if 𝑡 is a substring of 𝑠 , and 0 otherwise.
Once you receive the answer, output a single string in the following format:
"! s", where 𝑠 is a binary string of size 𝑛 . After that, proceed to solve the next test case.
If you make an incorrect attempt or exceed the limit of 2𝑛 attempts, you will receive −1 instead of an answer and get the verdict Wrong answer. In this case, your program should terminate immediately to avoid undefined verdicts.
- Assistant