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

建议使用的浏览器:

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

4270:Dynamic Lover

题目描述
As a famous person with universal love, changing girlfriend too often makes me harassment because I can't keep their name in mind timely. To remember who is my lover now, I buy a magic password-box from a wizard.
As a faithful atheist, I do not believe that it is caused by magic power. By doing a deep research, I find that all "magic" factors are just because a small software inside the box. Because the software only uses some simple data structure, it has a dissatisfied complexity.
Now I shortly introduce the principle of the software.
We will support a string with dynamic length and three kinds of operations on it. You can assume that we will always have an initial string.
*1. You will receive a short string, and you should connect it after the original string to make the new string.
*2. You will receive an integer len, and you should answer the query: for each index i (1 <= i <= LEN(nowString)), we will get a sub-string from i to i + len - 1 (if i + len - 1 > LEN(nowString), you should make the suffix from index i as its sub-string). You should output the index i whose sub-string has minimum lexicographic.
*3. You will receive an integer len. You should delete the suffix whose length is len from the string now and get a new string.
As a former ACMer, I want to make a new production with better execution speed. But I am not good at data structure, so I need your help.
输入解释
There are multiple test cases.
The first line contains a string as the initial string.
The next line contains an integer m (1 <= m <= 100,000) indicating the number of the operations.
Each of the next m lines begins with an integer k (1 <= k <= 3) indicating the kind of operation. If k = 1, it is followed by a short non-empty string, otherwise it is followed by an integer len.
We guarantee that the total length of the initial string and all short strings are not more than 100,000. And for each query, the len is not more than 1000 and the total sum of len is not more than 100,000.
All characters in the input are lower case.
输出解释
For each test case, you should output several lines.
For each query, you should output a line indicating the index i whose sub-string has minimum lexicographic. If more answers exist, output the minimal index.
输入样例
aacbab
5
2 2
1 aaa
2 3
3 2
2 3 
输出样例
1
9
7
来自杭电HDUOJ的附加信息
Recommend liuyiding

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

源链接: HDU-4270

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

共提交 0

通过率 --%
时间上限 内存上限
5000/1500MS(Java/Others) 65536/65536K(Java/Others)