#P7814. Alice and Bob
Alice and Bob
Alice and Bob
Problem Description
Alice and Bob decide to play a game. Denote set . Starting with Alice, take a number from in turn and put it at the end of a sequence with deleting it from . Initially the sequence is empty. indicates that contains an increasing subsequence of length at this time. There are two versions of the game: Version : Whoever makes the condition satisfied for the first time wins. Version : Whoever makes the condition satisfied for the first time loses. For the above two versions: whoever can't take out a number fails, i.e., is empty when it is his turn. In fact, they have already taken numbers totally from the set and none of them have won . Now please tell Alice if she can win. If she can, tell her how many ways she can take in the next step. You can assume that Alice and Bob are smart enough since the -th operation.
Input
The first line of the input contains a single integer (), the number of test cases. Each test case includes two lines: The first line contains integers , , , ( , , , \textbf{ is } , ), denoting the size of , the version of the game, the number of the numbers already taken, the parameter denoting the length of increasing subsequence. The second line contains integers denoting numbers taken out alreadly in order by steps. It is guaranteed that .
Output
For each test case: If Alice can't win, print a single line containing "". Otherwise, print a single line containing "" and an integer which denotes the number of different operations Alice can take in the next step to win with only one space seperated.
Sample Input
2
3 1 2 3
3 2
4 2 2 3
4 3
Sample Output
YES 1
NO
Source
2020 Multi-University Training Contest 5