Codeforces Round 354 (Div. 2)
E
The Last Fight Between Human and AI
Codeforces
2400
原题
← D→
翻译中…

100 years have passed since the last victory of the man versus computer in Go. Technologies made a huge step forward and robots conquered the Earth! It's time for the final fight between human and robot that will decide the faith of the planet.

翻译中…

The following game was chosen for the fights: initially there is a polynomial

翻译中…

$*P*(*x*) = *a*_{*n*}*x*^{*n*} + *a*_{*n* - 1}*x*^{*n* - 1} + ... + *a*_{1}*x* + *a*_{0},$

翻译中…

with yet undefined coefficients and the integer

翻译中…

k

翻译中…

. Players alternate their turns. At each turn, a player pick some index

翻译中…

j

翻译中…

, such that coefficient

翻译中…

aj

翻译中…

that stay near

翻译中…

xj

翻译中…

is not determined yet and sets it to

翻译中…

any

翻译中…

value (integer or real, positive or negative,

翻译中…

0

翻译中…

is also allowed). Computer moves first. The human will be declared the winner if and only if the resulting polynomial will be divisible by

翻译中…

Q(x) = x - k

翻译中…

.

翻译中…

Polynomial $*P*(*x*)$ is said to be divisible by polynomial $*Q*(*x*)$ if there exists a representation $*P*(*x*) = *B*(*x*)*Q*(*x*)$, where $*B*(*x*)$ is also some polynomial.

翻译中…

Some moves have been made already and now you wonder, is it true that human can guarantee the victory if he plays optimally?

翻译中…

Input

翻译中…

The first line of the input contains two integers $*n*$ and $*k*$ ($1 ≤ *n* ≤ 100 000, |*k*| ≤ 10 000$) — the size of the polynomial and the integer $*k*$.

翻译中…

The $*i*$-th of the following $*n* + 1$ lines contain character '?' if the coefficient near $*x*^{*i* - 1}$ is yet undefined or the integer value $*a*_{*i*}$, if the coefficient is already known ($- 10 000 ≤ *a*_{*i*} ≤ 10 000$). Each of integers $*a*_{*i*}$ (and even $*a*_{*n*}$) may be equal to $0$.

翻译中…

Please note, that it's not guaranteed that you are given the position of the game where it's computer's turn to move.

翻译中…

Output

翻译中…

Print "Yes" (without quotes) if the human has winning strategy, or "No" (without quotes) otherwise.

翻译中…

Note

翻译中…

In the first sample, computer set $*a*_{0}$ to $- 1$ on the first move, so if human can set coefficient $*a*_{1}$ to $0.5$ and win.

翻译中…

In the second sample, all coefficients are already set and the resulting polynomial is divisible by $*x* - 100$, so the human has won.

翻译中…

样例

Input #1
1 2
-1
?
Output #1
Yes
InputCopy OutputCopy
Input #2
2 100
-10000
0
1
Output #2
Yes
InputCopy OutputCopy
Input #3
4 5
?
1
?
1
?
Output #3
No
InputCopy OutputCopy
题目信息
题号
676E
时间限制
1 s
内存限制
256 MB
标签
数学

题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。