#K53612. Strictly Increasing Sequence after Removal

    ID: 29571 Type: Default 1000ms 256MiB

Strictly Increasing Sequence after Removal

Strictly Increasing Sequence after Removal

You are given an array of integers a of length n and an integer k. Your task is to determine whether it is possible to remove exactly k elements from a so that the remaining sequence, preserving the original order, is strictly increasing.

In other words, check if there exists a subsequence of length n - k (with indices i1, i2, ..., in-k satisfying 1 ≤ i1 < i2 < ... < in-k ≤ n) such that:

$$ a_{i_1} < a_{i_2} < \cdots < a_{i_{n-k}} $$

If such a subsequence exists, print YES; otherwise, print NO.

inputFormat

The first line contains an integer T denoting the number of test cases.

Each test case consists of two lines:

  • The first line contains two integers n and k.
  • The second line contains n space-separated integers representing the array a.

outputFormat

For each test case, output a single line containing either YES or NO indicating whether it is possible to obtain a strictly increasing sequence by removing exactly k elements.

## sample
3
5 2
5 3 4 7 8
3 0
2 1 3
4 2
1 3 2 6
YES

NO YES

</p>