knightnemo commited on
Commit
0d1690e
·
verified ·
1 Parent(s): ff31ef8

Upload code_segments/segment_276.txt with huggingface_hub

Browse files
Files changed (1) hide show
  1. code_segments/segment_276.txt +21 -0
code_segments/segment_276.txt ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ 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.
2
+
3
+ Believing in the strength of his password, Mansur stated that his password — is a binary string of length $n$. He is also ready to answer Dimash's questions of the following type:
4
+
5
+ Dimash says a binary string $t$, and Mansur replies whether it is true that $t$ is a substring of his password.
6
+
7
+ Help Dimash find out the password in no more than $2n$ operations; otherwise, Mansur will understand the trick and stop communicating with him.
8
+
9
+ Each test contains multiple test cases. The first line contains the number of test cases $t$ ($1 \le t \le 100$). The description of the test cases follows.
10
+
11
+
12
+
13
+ In the first example, the string $010$ is given. Therefore, the answers to the queries are as follows:
14
+
15
+ "? 00" $00$ is not a substring of $010$, so the answer is $0$.
16
+
17
+ "? 000" $000$ is not a substring, so the answer is $0$.
18
+
19
+ "? 010" $010$ is a substring, so the answer is $1$.
20
+
21
+ In the second example, the string is $1100$, in the third $0110$, and in the fourth $10$.