当前你的浏览器版本过低,网站已在兼容模式下运行,兼容模式仅提供最小功能支持,网站样式可能显示不正常。
请尽快升级浏览器以体验网站在线编辑、在线运行等功能。

建议使用的浏览器:

谷歌Chrome 火狐Firefox Opera浏览器 微软Edge浏览器 QQ浏览器 360浏览器 傲游浏览器

6863:Isomorphic Strings

题目描述
It is preferrable to read the pdf statment.

Two strings are called cyclical isomorphic if one can rotate one string to get another one. 'Rotate' here means ''to take some consecutive chars (maybe none) from the beginning of a string and put them back at the end of the string in the same order''. For example, string ''abcde'' can be rotated to string ''deabc''.

Now that you know what cyclical isomorphic is, Cuber QQ wants to give you a little test.

Here is a string $s$ of length $n$. Please check if $s$ is a concatenation of $k$ strings, $s_1,s_2,\cdots,s_k$ ($k>1$), where,

  • $k$ is a divisor of $n$;

  • $s_1,s_2,\ldots,s_k$ are of equal length: $\frac{n}{k}$;

  • There exists a string $t$, which is cyclical isomorphic with $s_i$ for all $1\le i\le k$.


Print ''Yes'' if the check is positive, or ''No'' otherwise.
输入解释
The first line contains an integer $T$ ($1\le T\le 1000$), denoting the number of test cases. $T$ cases follow.

  • The first line of each test case contains an integer $n$ ($1\le n \le 5 \cdot 10^6$).

  • The second line contains a string $s$ of length $n$ consists of lowercase letters only.


It is guaranteed that the sum of $n$ does not exceed $2\cdot 10^7$.
输出解释
For each test case, output one line containing ''Yes'' or ''No'' (without quotes).
输入样例
6
1
a
2
aa
3
aab
4
abba
6
abcbcc
8
aaaaaaaa
输出样例
No
Yes
No
Yes
No
Yes
来自杭电HDUOJ的附加信息
Recommend IceyWang

该题目是Virtual Judge题目,来自 杭电HDUOJ

源链接: HDU-6863

最后修改于 2020-10-25T23:35:01+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
8000/8000MS(Java/Others) 524288/524288K(Java/Others)