AtCoder Regular Contest 155
翻译中…
Problem Statement
翻译中…
You are given a string $S$ of length $N$ consisting of lowercase English letters, and a positive integer $K$.
翻译中…
Determine whether there is a string $S'$ of length $K$ that satisfies the following conditions.
翻译中…
- The concatenation of
$S$and$S'$in this order is a palindrome. - The concatenation of
$S'$and$S$in this order is a palindrome.
翻译中…
You have $T$ test cases to solve.
翻译中…
Constraints
翻译中…
$1 \leq T \leq 10^5$$1 \leq N \leq 2 \times 10^5$$1 \leq K \leq 10^{18}$$S$is a string of length$N$consisting of lowercase English letters.- All numbers in the input are integers.
- In each input file, the sum of
$N$over the test cases is at most$2 \times 10^5$.
翻译中…
Input
翻译中…
The input is given from Standard Input in the following format:
翻译中…
T
\mathrm{case}_1
\vdots
\mathrm{case}_T
翻译中…
Each case is in the following format:
翻译中…
N K
S
翻译中…
Output
翻译中…
Print $T$ lines. The $i$-th line should contain Yes if there is a string $S'$ that satisfies the conditions for the $i$-th test case, and No otherwise.
翻译中…
样例
Input #1
2
6 2
abbaab
5 3
abcbb
Output #1
Yes
No
For the first test case, if we let $S' = {}$`ba`, for instance, the concatenation of $S$ and $S'$ in this order will be `abbaabba`, which is a palindrome. Here, the concatenation of $S'$ and $S$ in this order is `baabbaab`, which is also a palindrome. Thus, $S' = {}$`ba` satisfies the condition, so the answer is `Yes`.
For the second test case, we can prove that no string satisfies the conditions.
Input #2
3
12 400378271514996652
njvhhvjnnjvh
10 884633988115575508
rrhiyvrrur
36 71630165869626180
vsxmxajrrduhhudrrjaxmxsvvsxmxajrrduh
Output #2
Yes
No
Yes
题目信息
题面与样例版权归 AtCoder 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。