Prefix Min and Suffix Max
You are given an array
In one operation, you may either:
- choose a nonempty prefix
∗ ofa and replace it with its minimum value, or - choose a nonempty suffix
† ofa and replace it with its maximum value.
Note that you may choose the entire array
For each element
The first line contains an integer
The first line of each test case contains one integer
The second line of each test case contains
It is guaranteed that the sum of
For each test case, output a binary string of length
361 3 5 4 7 2413 10 12 2071 2 3 4 5 6 7
100011 1101 1000001
In the first sample, you can first choose the prefix of size
| 1 | 4 | 7 | 2 |
| 1 | 4 | 7 |
| 1 |
It can be shown that it is impossible to transform