CF1256D Binary String Minimizing

题目描述

给定一个长度为n的二进制串(即由n个'0'和'1'构成的字符串),你最多可以进行k次交换相邻两个字符的操作。 一共q组询问。

输入格式

第一行一个整数q(1≤q≤1e4),为测试用例的数量。 每组测试数据的第一行为两个整数,字符串的长度n和可以执行的移动次数k。 每组测试数据的第二行为一个由'0'和'1'构成的长度为n的字符串。

输出格式

对于每个测试数据,请输出对原字符串进行不超过k次交换操作后的**字典序**最小的字符串。

说明/提示

In the first example, you can change the string as follows: $ 1\underline{10}11010 \rightarrow \underline{10}111010 \rightarrow 0111\underline{10}10 \rightarrow 011\underline{10}110 \rightarrow 01\underline{10}1110 \rightarrow 01011110 $ . In the third example, there are enough operations to make the string sorted.