#P9687. Maps.
Maps.
Problem Description
Xiao Y wants to get a map, but this map is a bit special.
This map is a grid with length units and width unit. Each cell must be colored either white () or black ().
You want to fulfill Xiao Y’s wish and give him such a map, but then Xiao Y提出 two more requirements:
- For every white cell that is not at either end of the grid, there are exactly cells such that this cell’s left and right neighboring cells are both colored black.
- While satisfying all the conditions above, the string formed by the characters from left to right is lexicographically smallest.
You think these requirements are easy, so you start creating.
Input Format
This problem has multiple test cases.
The first line contains a positive integer , which denotes the number of test cases.
For each test case:
One line contains two integers , which denote the length of the map you need to construct and Xiao Y’s requirement.
Output Format
For each test case, output one line containing a 01 string of length , representing the map you construct. If it is impossible to find any map that satisfies Xiao Y’s requirements, output .
5
5 1
3 1
5 3
5 4
5 5
00101
101
-1
-1
-1
Hint
Sample Explanation #1
For the first test case: only the cell at the -th character satisfies that it is , is not on the border of the map, and both surrounding cells are , so it meets the condition. It can be proven that this is the lexicographically smallest solution that satisfies the conditions.
For the third test case: it can be proven that there is no solution with length and with cells such that the cell itself is , is not on the border, and both surrounding characters are .
Constraints
For all testdata, , .
This problem uses bundled tests. Test points with the same constraints are bundled into one .
The additional constraints for each test point are shown in the table below.
| Test Point | |
|---|---|
Translated by ChatGPT 5