Codeforces Round 995 (Div. 3) |
---|
Finished |
Monocarp is preparing for his first exam at the university. There are $$$n$$$ different questions which can be asked during the exam, numbered from $$$1$$$ to $$$n$$$. There are $$$m$$$ different lists of questions; each list consists of exactly $$$n-1$$$ different questions. Each list $$$i$$$ is characterized by one integer $$$a_i$$$, which is the index of the only question which is not present in the $$$i$$$-th list. For example, if $$$n = 4$$$ and $$$a_i = 3$$$, the $$$i$$$-th list contains questions $$$[1, 2, 4]$$$.
During the exam, Monocarp will receive one of these $$$m$$$ lists of questions. Then, the professor will make Monocarp answer all questions from the list. So, Monocarp will pass only if he knows all questions from the list.
Monocarp knows the answers for $$$k$$$ questions $$$q_1, q_2, \dots, q_k$$$. For each list, determine if Monocarp will pass the exam if he receives that list.
The first line contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases.
Each test case consists of three lines:
Additional constraints on the input:
For each test case, print a string of $$$m$$$ characters. The $$$i$$$-th character should be 1 if Monocarp passes the exam if he receives the $$$i$$$-th question list, 0 if Monocarp won't pass.
44 4 31 2 3 41 3 45 4 31 2 3 41 3 44 4 41 2 3 41 2 3 42 2 11 22
0100 0000 1111 10
In the first test case, Monocarp knows the questions $$$[1, 3, 4]$$$. Let's consider all the question lists:
Name |
---|