Doremy’s IQ Solution Codeforces
Doremy is asked to testcontests. Contest can only be tested on day . The difficulty of contest is . Initially, Doremy’s IQ is . On day Doremy will choose whether to test contest or not. She can only test a contest if her current IQ is strictly greater than .
If Doremy chooses to test conteston day , the following happens:
- if , Doremy will feel she is not wise enough, so decreases by ;
- otherwise, nothing changes.
If she chooses not to test a contest, nothing changes.Doremy wants to test as many contests as possible. Please give Doremy a solution.
Input Doremy’s IQ Solution Codeforces
The input consists of multiple test cases. The first line contains a single integer( ) — the number of test cases. The description of the test cases follows.
The first line contains two integersand ( , ) — the number of contests and Doremy’s IQ in the beginning.
The second line containsintegers ( ) — the difficulty of each contest.
It is guaranteed that the sum ofover all test cases does not exceed .
Output Doremy’s IQ Solution Codeforces
For each test case, you need to output a binary string, where if Doremy should choose to test contest , and otherwise. The number of ones in the string should be maximum possible, and she should never test a contest when her IQ is zero or less.
If there are multiple solutions, you may output any.
5 1 1 1 2 1 1 2 3 1 1 2 1 4 2 1 4 3 1 5 2 5 1 2 4 3
1 11 110 1110 01111
Note Doremy’s IQ Solution Codeforces
In the first test case, Doremy tests the only contest. Her IQ doesn’t decrease.
In the second test case, Doremy tests both contests. Her IQ decreases byafter testing contest .
In the third test case, Doremy tests contestand . Her IQ decreases to after testing contest , so she can’t test contest .