#Lutece2617. basic string problem
basic string problem
Migrated from Lutece 2617 basic string problem
All parts of this problem, including description, images, samples, data and checker, might be broken. If you find bugs in this problem, please contact the admins.
Description
在最开始时你有一个空字符串。
给出 个操作,操作分为以下两种:
1 x c
在字符串后面加上 个小写英文字符 ;2 x
把字符串还原到第 次操作之后的样子。
在每次操作完之后,对字符串的所有前缀的最大 border 求和。
border 的定义请参阅 KMP。
Input
第一行一个数字 代表操作次数。 接下来 行按照题面形式给出。
Output
输出 行,每行一个数代表答案对 取模之后的结果。
Samples
10
1 5 s
1 5 u
1 5 g
1 5 a
1 5 s
1 4 u
1 3 g
2 5
1 5 u
1 3 g
10
10
10
10
25
55
55
25
65
101
Constraints
。 操作一中的 满足 。 对于第 次询问保证 。 保证每一次添加字符 时,字符串的末尾字符不是 。
Resources
2021 UESTC ICPC Training for String and Search Algorithm