当前你的浏览器版本过低,网站已在兼容模式下运行,兼容模式仅提供最小功能支持,网站样式可能显示不正常。
请尽快升级浏览器以体验网站在线编辑、在线运行等功能。

建议使用的浏览器:

谷歌Chrome 火狐Firefox Opera浏览器 微软Edge浏览器 QQ浏览器 360浏览器 傲游浏览器

6819:Alice and Bob

题目描述
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.
输入解释
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}]$.
输出解释
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.
输入样例
2
3 1 2 3
3 2
4 2 2 3
4 3
输出样例
YES 1
NO
来自杭电HDUOJ的附加信息
Recommend IceyWang

该题目是Virtual Judge题目,来自 杭电HDUOJ

源链接: HDU-6819

最后修改于 2020-10-25T23:34:40+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
2000/1000MS(Java/Others) 131072/131072K(Java/Others)