Not-So-Long Increasing Subsequence
시간 제한2초메모리 제한256 MB
순열과 길이 K가 주어질 때, 최장 증가 부분 수열의 길이가 (K+1)/2 이하인 길이 K의 부분 수열을 찾거나, 존재하지 않음을 판정한다.
문제
Let be positive integers satisfying . Busy Beaver has a permutation1 of . A length subsequence2 of given by is interesting if the longest increasing3 subsequence of has length at most .
Determine whether Busy Beaver's permutation has an interesting subsequence of length , and if it exists, provide such an example of an interesting subsequence.
1A permutation of length is an array consisting of distinct integers from to in arbitrary order. For example, is a permutation, but is not a permutation ( appears twice in the array), and is also not a permutation ( but there is in the array).
2A sequence is a subsequence of a sequence if can be obtained from by the deletion of several (possibly, zero or all) elements.
3A sequence is increasing if . For instance, is increasing while is not.
입력
Each test contains multiple test cases. The first line of input contains a single integer , the number of test cases. The description of each test case follows.
The first line of each test case contains two space-separated integers ().
The second line of each test case contains integers (, pairwise distinct) --- Busy Beaver's permutation.
It is guaranteed that the sum of across all test cases is no more than .
출력
For each test case, output "YES" (without quotes) if there exists an interesting subsequence, and "NO" (without quotes) otherwise. You can output "YES" and "NO" in any case (for example, strings "yES", "yes" and "Yes" will be recognized as a positive response).
Then, if you responded with "YES", print a second line consisting of space-separated integers (), the indices of the permutation such that is an interesting subsequence. If there are multiple possible solutions, print any of them.
힌트
In the first test case, the subsequence has two longest increasing subsequences and , each of which has length at most It is therefore an interesting subsequence.
In the second test case, the subsequence has a unique longest increasing subsequence given by , which has length at most It is therefore an interesting subsequence.
In the third test case, the only subsequence of length is the entire sequence . The longest increasing subsequence of this sequence is . As its length is greater than , there is no interesting subsequence.