#P176. [Entry U114/T1] 01-strings and 01-subsequences
[Entry U114/T1] 01-strings and 01-subsequences
Source
The problem is proposed by . All rights reserved.
Problem source: http://8.136.99.126/blog/114/686bb169ab85cef1c18668cc
Problem Description
Construct a binary string of length containing exactly subsequences , or determine that no solution exists.
Input Format
This problem contains multiple test cases.
The first line contains a positive integer indicating the number of test cases.
Each of the next lines contains two non-negative integers and .
Output Format
If a solution exists, output the constructed 01 string. Otherwise, output exclamation marks (!
, ASCII code ).
Samples
4
2 4
6 8
10 12
14 16
!!
001111
0101011100
11100001111000
Tips
For of the test cases, and .
For of the test cases, , , and .
It is guaranteed that the sum of across all test cases does not exceed .