C1. Skibidus and Fanum Tax (easy version)
This is the easy version of the problem. In this version, .
Skibidus has obtained two arrays and , containing and elements respectively. For each integer from to , he is allowed to perform the operation at most once:
- Choose an integer such that . Set . Note that may become non-positive as a result of this operation.
Skibidus needs your help determining whether he can sort in non-decreasing order by performing the above operation some number of times.
is sorted in non-decreasing order if .
The first line contains an integer () — the number of test cases.
The first line of each test case contains two integers and (, ).
The following line of each test case contains integers ().
The following line of each test case contains integers ().
It is guaranteed that the sum of and the sum of over all test cases does not exceed .
For each test case, if it is possible to sort in non-decreasing order, print "YES" on a new line. Otherwise, print "NO" on a new line.
You can output the answer in any case. For example, the strings "yEs", "yes", and "Yes" will also be recognized as positive responses.
51 1593 11 4 334 11 4 2 564 15 4 10 543 19 8 78
YES NO YES NO YES
In the first test case, is already sorted.
In the second test case, it can be shown that it is impossible.
In the third test case, we can set . The sequence is in nondecreasing order.
In the last case, we can apply operations on each index. The sequence becomes , which is in nondecreasing order.