|
||||||||||
Alice and BobTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 131072/131072 K (Java/Others)Total Submission(s): 24 Accepted Submission(s): 11 Problem Description Alice and Bob decide to play a game. Denote set $S=\{i | i \in [1,n]\}$. Starting with Alice, take a number from $S$ in turn and put it at the end of a sequence $A$ with deleting it from $S$. Initially the sequence $A$ is empty. $P(A)$ indicates that $A$ contains an increasing subsequence of length $k$ at this time. There are two versions of the game: $\qquad$Version $1$: Whoever makes the condition $P(A)$ satisfied for the first time wins. $\qquad$Version $2$: Whoever makes the condition $P(A)$ satisfied for the first time loses. For the above two versions: whoever can't take out a number fails, i.e., $S$ is empty when it is his turn. In fact, they have already taken $q$ numbers totally from the set $S$ 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 $q+1$-th operation. Input The first line of the input contains a single integer $T$ ($1\le T\le1000$), the number of test cases. Each test case includes two lines: The first line contains $4$ integers $n$, $v$, $q$, $k$ ( $3\le n\le10^{5}$ , $1\le v\le2$, $2\le q< n$, \textbf{$q$ is $even$} , $2\le k\le10^{5}$ ), denoting the size of $S$, the version of the game, the number of the numbers already taken, the parameter denoting the length of increasing subsequence. The second line contains $q$ integers denoting numbers taken out alreadly in order by steps. It is guaranteed that $\sum n, \sum q \in [1,10^{6}]$. Output For each test case: If Alice can't win, print a single line containing "$NO$". Otherwise, print a single line containing "$YES$" 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
Sample Output
Source | ||||||||||
|