

The first line of input contains an integer 'T' representing the number of test cases.
The first line of each test case contains a single integer, ‘N’, where ‘N’ denotes the number of houses in a single row in ninja island.
The second line of each test case contains two space-separated integers, ‘K1’ and ‘K2’, where ‘K1’ and ‘K2’ denote the number of houses occupied by ninjas in the first and second row, respectively.
The third line of each test case contains ‘N’ space-separated integers, representing the number of houses occupied by ninjas in each of the ‘N’ columns.
For each test case, print a single line containing “1” if you have returned the correct 2 * ‘N’ binary grid, where 0 and 1 in the grid represent that the house is occupied by ordinary people and ninjas, respectively, else the output will be “0”.
The output of each test case will be printed in a separate line.
You do not need to print anything, it has already been taken care of. Just implement the given function.
1 <= T <= 5
1 <= N <= 5000
0 <= K1, K2 <= N
0 <= ARR[ i ] <= 2
Where ‘T’ is the number of test cases, ‘N’ denotes the number of houses in a single row in ninja island, ‘K1’ and ‘K2’ denote the number of houses occupied by ninjas in the first and second row of the grid, respectively, and ‘ARR[i]’ denotes the number of houses occupied by ninjas in the i-th column.
Time limit: 1 sec.
The idea here is to iterate through all the ‘N’ columns from left to right and greedily assign houses to ninjas. For all the columns where two houses are occupied by ninjas, we can directly assign both the houses to ninjas. Similarly, for all the columns where 0 houses are occupied by ninjas, we assign both houses to ordinary people. Now, for all the columns where one house is occupied by ninjas, we assign a house in the first row if the number of remaining houses occupied by ninjas in the first row is greater than the number of remaining houses occupied by ninjas in the second row. Otherwise, we assign a house in the second row.