Technocup 2021 - Elimination Round 3
E
Poman Numbers
Codeforces
2300
原题
← DF →
翻译中…

You've got a string $S$ consisting of $n$ lowercase English letters from your friend. It turned out that this is a number written in poman numerals. The poman numeral system is long forgotten. All that's left is the algorithm to transform number from poman numerals to the numeral system familiar to us. Characters of $S$ are numbered from $1$ to $n$ from left to right. Let's denote the value of $S$ as $f(S)$, it is defined as follows:

翻译中…
  • If $|S| \gt 1$, an arbitrary integer $m$ ($1 \le m \lt |S|$) is chosen, and it is defined that $f(S) = -f(S[1, m]) + f(S[m + 1, |S|])$, where $S[l, r]$ denotes the substring of $S$ from the $l$-th to the $r$-th position, inclusively.
  • Otherwise $S = c$, where $c$ is some English letter. Then $f(S) = 2^{pos(c)}$, where $pos(c)$ is the position of letter $c$ in the alphabet ($pos($a$) = 0$, $pos($z$) = 25$).
翻译中…

Note that $m$ is chosen independently on each step.

翻译中…

Your friend thinks it is possible to get $f(S) = T$ by choosing the right $m$ on every step. Is he right?

翻译中…

Input

翻译中…

The first line contains two integers $n$ and $T$ ($2 \leq n \leq 10^5$, $-10^{15} \leq T \leq 10^{15}$).

翻译中…

The second line contains a string $S$ consisting of $n$ lowercase English letters.

翻译中…

Output

翻译中…

Print "Yes" if it is possible to get the desired value. Otherwise, print "No".

翻译中…

You can print each letter in any case (upper or lower).

翻译中…

Note

翻译中…

In the second example, you cannot get $-7$. But you can get $1$, for example, as follows:

翻译中…
  1. First choose $m = 1$, then $f($abc$) = -f($a$) + f($bc$)$
  2. $f($a$) = 2^0 = 1$
  3. $f($bc$) = -f($b$) + f($c$) = -2^1 + 2^2 = 2$
  4. In the end $f($abc$) = -1 + 2 = 1$
翻译中…

样例

Input #1
2 -1
ba
Output #1
Yes
InputCopy OutputCopy
Input #2
3 -7
abc
Output #2
No
InputCopy OutputCopy
Input #3
7 -475391
qohshra
Output #3
Yes
InputCopy OutputCopy
题目信息
题号
1411E
时间限制
1 s
内存限制
256 MB
标签
位运算
贪心
数学
字符串

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