|
||||||||||
MedianTime Limit: 2000/2000 MS (Java/Others) Memory Limit: 524288/524288 K (Java/Others)Total Submission(s): 1389 Accepted Submission(s): 575 Problem Description Mr. docriz has $n$ different integers $1, 2, \cdots, n$. He wants to divide these numbers into $m$ disjoint sets so that the median of the $j$-th set is $b_j$. Please help him determine whether it is possible. Note: For a set of size $k$, sort the elements in it as $c_1, c_2, \cdots, c_k$, the median of this set is defined as $c_{\lfloor (k+1)/2 \rfloor}$. Input The first line contains an integer $T(1 \leq T \leq 1000)$ - the number of test cases. Then $T$ test cases follow. The first line of each test case contains $2$ integers $n, m(1 \leq m \leq n \leq 10^5)$ - the number of integers that Mr. docriz has, and the number of sets he want to divide these numbers into. The next line contains $m$ integers $b_1, b_2, \cdots, b_m(1 \leq b_i \leq n)$. It is guaranteed that all the numbers in $b$ are distinct. It is guaranteed that $\sum n \leq 2 \times 10^6$. Output For each test case, output "YES'' if it is possible to achieve his goal, or "NO'' otherwise. Sample Input
Sample Output
Source | ||||||||||
|