TheForces Round #16 (2^4-Forces) |
---|
Finished |
Consider a binary number $$$x$$$.Define $$$c0(x)$$$ as the number of $$$0$$$ in $$$x$$$,$$$c1(x)$$$ as the number of $$$1$$$ in $$$x$$$.
For example,$$$x=10100$$$,we can get $$$c0(x)=3,c1(x)=2$$$.
Now you're given a binary number $$$y$$$(without leading zero) of length $$$n$$$ and an integer $$$k$$$.Your task is find the smallest binary number $$$x$$$(without leading zero),which satisfies:
The first line of input will contain a single integer $$$t(1 \leq t \leq 10^5)$$$, denoting the number of test cases.
Each test case consists of two line of input.
The first line contains two integers $$$n,k(1 \leq n \leq 10^5,-10^5 \leq k \leq 10^5)$$$.
The second line contains a binary number $$$y$$$(without leading zero) of length $$$n$$$.
The sum of $$$n,|k|$$$ over all test cases will not exceed $$$4*10^5$$$.
For each test case,output on a new line — the smallest binary number $$$x$$$(without leading zero),which satisfies:
5 1 -1 0 6 -4 110100 6 1 100000 7 1 1110000 10 -2 1011010111
1 110111 1000011 1110000 1011011001
Name |
---|