[Solution] Creep Codeforces Solution | Codeforces Problem Solution 2022
Define the score of some binary string as the absolute difference between the number of zeroes and ones in it. (for example, 010001 contains zeroes and ones, so the score of is ).
Define the creepiness of some binary string as the maximum score among all of its prefixes (for example, the creepiness of 01001 is equal to because the score of the prefix is and the rest of the prefixes have a score of or less).
Given two integers and , construct a binary string consisting of zeroes and ones with the minimum possible creepiness.
The first line contains a single integer — the number of test cases. The description of the test cases follows.
The only line of each test case contains two integers and () — the numbers of zeroes and ones correspondingly.
For each test case, print a binary string consisting of zeroes and ones with the minimum possible creepiness. If there are multiple answers, print any of them.
No comments:
Post a Comment