No.2155 Michira Color
タグ : / 解いたユーザー数 176
作問者 :
Michirakara
/ テスター :
kotamanegi
KowerKoint2010
hibit_at
Problem Statement
michirakara has finally reached his long-awaited goal of a rating in the $3200$s on AtCoder.
On AtCoder, users with a rating of $3200$ or higher can display their name in any color they like.
michirakara wants to display his name in a certain color $M$.
However, michirakara has no sense of style, so the only way he can make a color is by mixing two colors.
The color obtained by mixing colors $A$ and $B$ is $\left\lfloor\cfrac{A+B}{2}\right\rfloor$.
michirakara wants the color of his name to be $M$.
michirakara's initial color is $L$.
Given $L$ and $N$ colors $A_1,A_2,\dots ,A_N$, print Yes if the color $M$ can be made by mixing colors, and No otherwise.
Each of the colors $A_1,A_2,\dots ,A_N$ can either be used for mixing, or be left unused so that the current color is kept.
The $N$ colors are mixed in order from $A_1$ to $A_N$.
For example, it is possible to mix $A_1$, skip $A_2$, and then mix $A_3$, but it is not possible to mix $A_1$ after mixing $A_3$.
Input
$N\ M \ L$ $A_1\ A_2\dots A_N$
- $1\leq N\leq 100$
- $1\leq M\leq 1000$
- $1\leq L\leq 1000$
- $1\leq A_i\leq 1000(1\leq i\leq N)$
- All inputs are integers.
Sample
Sample 1
Input
5 10 5 9 10 13 14 12
Output
Yes
For example, mixing color $9$ into the initial color $5$ gives $\lfloor\cfrac{5+9}{2}\rfloor =7$, mixing $10$ into that gives $\lfloor\cfrac{7+10}{2}\rfloor =8$, and further mixing $13$ gives $\lfloor\cfrac{8+13}{2}\rfloor =10$, so it is possible to end up with the color $10$.
Sample 2
Input
5 10 5 1 2 8 4 7
Output
No
Sample 3
Input
1 5 5 1
Output
Yes
提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。