题目链接:http://poj.org/problem?id=1509 题目意思就是求循环字符串的最小表示. 我们用字符串S+S建立SAM,然后从root开始走n步,每次尽量选最小的. 由于 SAM 可以接受 SS 所有的子串,而字典序最小的字符串也必定是 SS 的子串,因此按照上面的规则移动就可以找到一个字典序最小的子串. 这里的right等价类的len显然可以直接扩展到串首,于是开始的位置就是T[o].len-n+1. #include<cstdio> #include<cstrin…
Time Limit: 3000MS Memory Limit: 10000K Total Submissions: 4901 Accepted: 2765 Description Once upon a time there was a famous actress. As you may expect, she played mostly Antique Comedies most of all. All the people loved her. But she was not i…
Glass Beads Time Limit: 3000MS Memory Limit: 10000K Total Submissions: 4314 Accepted: 2448 Description Once upon a time there was a famous actress. As you may expect, she played mostly Antique Comedies most of all. All the people loved her. But s…
LCS2 - Longest Common Substring II no tags A string is finite sequence of characters over a non-empty finite set Σ. In this problem, Σ is the set of lowercase letters. Substring, also called factor, is a consecutive sequence of characters occurrence…