AtCoder Regular Contest 157
翻译中…
Problem Statement
翻译中…
Determine whether there is a string $S$ of length $N$ consisting of X and Y that satisfies the following condition.
翻译中…
Condition: Among the $(N - 1)$ pairs of consecutive characters in $S$,
翻译中…
- exactly
$A$areXX, - exactly
$B$areXY, - exactly
$C$areYX, and - exactly
$D$areYY.
翻译中…
Constraints
翻译中…
$1 \leq N \leq 2 \times 10^5$$A \geq 0$$B \geq 0$$C \geq 0$$D \geq 0$$A + B + C + D = N - 1$
翻译中…
Input
翻译中…
The input is given from Standard Input in the following format:
翻译中…
N A B C D
翻译中…
Output
翻译中…
If there is a string $S$ that satisfies the condition, print Yes; otherwise, print No.
翻译中…
样例
Input #1
5 1 1 1 1
Output #1
Yes
For instance, if $S = {}$`XXYYX`, the pairs of consecutive characters are `XX`, `XY`, `YY`, and `YX` from left to right. Each pattern occurs exactly once, so the condition is satisfied.
Input #2
5 1 2 1 0
Output #2
Yes
For instance, $S = {}$`XXYXY` satisfies the condition.
Input #3
5 0 4 0 0
Output #3
No
No string satisfies the condition.
题目信息
题面与样例版权归 AtCoder 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。