A + B Problem
시간 제한2초메모리 제한512 MB
이진 문자열을 주어진 길이의 두 부분수열로 나눠 두 이진수의 합이 최대가 되도록 만들고, 그 합을 이진수로 출력한다.
문제
A binary string is a string consisting only of digits "" and "". Given a binary string of length , please divide it into two subsequences of length and of length such that each digit in belongs to exactly one subsequence.
Let be the function that transforms a sequence of "" and "" into a binary integer. For example, and . Your task is to find such and that maximize .
Recall that a subsequence of a string is a sequence that can be derived by deleting some characters (possibly none) from the string without changing the order of the remaining characters.
입력
There are multiple test cases. The first line of the input contains an integer indicating the number of test cases. For each test case:
The first line contains two integers and () indicating the lengths of the desired subsequences.
The second line contains a binary string (, s\_i \in \\{\text{"0"}, \text{"1"}\\}).
It is guaranteed that the sum of of all test cases will not exceed .
출력
For each test case, output one line containing a binary integer indicating the largest possible result of . Note that should be printed as a binary integer with no leading zeroes, while and are sequences, and leading zeros are allowed in the sequences.
힌트
We now use underline to indicate subsequence in the binary string.
For the first sample test case, a valid solution is to divide the binary string into such that .
For the second sample test case, a valid solution is to divide the binary string into such that .