CF2114B Not Quite a Palindromic String

Description

Vlad found a binary string $ ^{\text{∗}} $ $ s $ of even length $ n $ . He considers a pair of indices ( $ i, n - i + 1 $ ), where $ 1 \le i < n - i + 1 $ , to be good if $ s_i = s_{n - i + 1} $ holds true. For example, in the string '010001' there is only $ 1 $ good pair, since $ s_1 \ne s_6 $ , $ s_2 \ne s_5 $ , and $ s_3=s_4 $ . In the string '0101' there are no good pairs. Vlad loves palindromes, but not too much, so he wants to rearrange some characters of the string so that there are exactly $ k $ good pairs of indices. Determine whether it is possible to rearrange the characters in the given string so that there are exactly $ k $ good pairs of indices ( $ i, n - i + 1 $ ). $ ^{\text{∗}} $ A string $ s $ is called binary if it consists only of the characters '0' and '1'

Input Format

The first line contains an integer $ t $ ( $ 1 \le t \le 10^4 $ ) — the number of test cases. The first line of each test case contains two integers $ n $ and $ k $ ( $ 2 \le n \le 2 \cdot 10^5 $ , $ 0 \le k \le \frac{n}{2} $ , $ n $ is even) — the length of the string and the required number of good pairs. The second line of each test case contains a binary string $ s $ of length $ n $ . It is guaranteed that the sum of $ n $ across all test cases does not exceed $ 2 \cdot 10^5 $ .

Output Format

For each test case, output "YES" if there is a way to rearrange the characters of the string so that there are exactly $ k $ good pairs, otherwise output "NO". You may output each letter in any case (lowercase or uppercase). For example, the strings "yEs", "yes", "Yes", and "YES" will be accepted as a positive answer.