#C1458. Special Subarray
Special Subarray
Special Subarray
You are given an array A of N integers along with two integers X and K. A subarray is defined as a contiguous segment of the array. A subarray is considered special if its length is at least K and it contains at least one element satisfying (A_i \ge X). In other words, for a subarray A[l...r] (where (r - l + 1 \ge K)), there must exist an index i such that (l \le i \le r) and (A_i \ge X).
Your task is to determine whether there exists at least one special subarray in the given array. If such a subarray exists, print "YES"; otherwise, print "NO".
For example:
- For N = 5, X = 10, K = 3, and A = [1, 2, 3, 4, 5], there is no subarray of length at least 3 that contains an element (\ge 10), so the answer is "NO".
- For N = 5, X = 3, K = 2, and A = [2, 3, 1, 4, 5], at least one special subarray exists (for example, [2, 3]), so the answer is "YES".
inputFormat
The input is given from standard input (stdin) and has the following format:
The first line contains an integer T, the number of test cases.
For each test case:
- The first line contains three space-separated integers: N, X, and K.
- The second line contains N space-separated integers representing the array A.
Note: Each test case should be processed independently.
outputFormat
For each test case, output a single line to standard output (stdout) containing "YES" if there exists a special subarray; otherwise, output "NO".## sample
5
5 10 3
1 2 3 4 5
5 3 2
2 3 1 4 5
4 7 2
7 8 9 10
3 4 1
1 2 3
5 5 3
5 6 7 8 9
NO
YES
YES
NO
YES
</p>