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

建议使用的浏览器:

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

6192:Removing Mountains

题目描述
Long long time ago, there was a foolish man called Yu Gong. One day, he found that the mountains around his house was really troublesome, so he decided to remove them. The work had been doing year in and year out.

It is 2030 now. With the development of technologies, the transportations have been really convenient, so the descendants of Yu Gong don't need to remove these mountains any more. Instead, they want to make the mountains more beautiful. In their opinion, the mountains are beautiful if they have a cyclical character. Furthermore, smaller the repetition period is, greater the mountains they deem.

The mountains can be considered a sequence of positive integers $a_{1},a_{2},...,a_{n}$, each of which indicates an altitude. We say the repetition period of the sequences is $k$ if $k$ is the smallest number which satisfy that for every integer $i$, $k+1 \leq i \leq n$, $a_{i}$ always equals to $a_{i-k}$. For example, the repetition period of the following sequence:1 2 3 2 1 2 3 2 1 2 3 is 4.

Now the descendants of Yu Gong want to the make mountains more beautiful by changing altitude in one position. Please tell them the smallest repetition period after changing altitude and also the number of positions they can choose to change altitude in order to reach the smallest repetition period. Note that they can change any meter (including zero) in one position.
输入解释
There are lots of test cases.
For each test case, the first line contains a positive integer $n$, $1 \leq n \leq 10^6$, denoting the length of the sequence. Next line is the sequence $a_{1},...,a_{n}$, $0 \leq a_{i} \leq 9$. There are no spaces between $a_{i}$ and $a_{i+1}$.
The whole input satisfies $\sum{n} \leq 6 \times 10^6$.
输出解释
For each test case, output two integers seperated by one space in a line, denoting the answer.
输入样例
5
32321
输出样例
2 1
来自杭电HDUOJ的附加信息
Recommend liuyiding

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

源链接: HDU-6192

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

共提交 0

通过率 --%
时间上限 内存上限
2000/1000MS(Java/Others) 32768/32768K(Java/Others)