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

建议使用的浏览器:

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

5891:String

题目描述
Alice just tries to maintain a string, with a kind of operation and a kind of query.
The kind of operation allows to insert a character at the end of the string.
The kind of query considers the substring, denoted by $T$, of the string from the $l$-th character to the $r$-th one, and asks the maximum length of substring of $T$ which appears at least twice in $T$.
If no substring appears at least twice in $T$, the outcome should be $0$.
输入解释
The first line consists a string in lowercase and a positive integer m. We use $len$ to denote the length of this string.
Each of the following m lines consists a operation or a query.

We define a temporary variable $tmp$ and it is initially set to $0$.
We use the format "1 c" to describe the operation where $(c-'a'+tmp)~mod~26+'a'$ is the new character.
We use the format "2 l r" to describe the query where $(l-1+tmp)~mod~len+1$ and $(r-1+tmp)~mod~len+1$ are the indexes of substring $T$.
We guarantee that $1\le (l-1+tmp)~mod~len+1\le (r-1+tmp)~mod~len+1\le len$ and after this query $tmp$ should be modified to the outcome.

The initial length of the string and $m$ are no more than $50000$.
输出解释
For each query, out the outcome in one line.
输入样例
aabda 6
2 1 4
1 a
2 1 5
1 b
2 6 5
2 7 4
输出样例
1
2
3
2
来自杭电HDUOJ的附加信息
Recommend wange2014

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

源链接: HDU-5891

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

共提交 0

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