题目链接 题意:给你一个字符串,每次从首或尾取一个字符组成字符串,问所有能够组成的字符串中字典序最小的一个。 思路:首先定义两个指针L和R,如果s[L]<s[R],肯定选s[R],s[L]>s[R],选s[R].对于s[L]==s[R]的情况,可以考虑L位置的rank以及R位置反串的rank值大小。 Read More
posted @ 2020-10-11 19:56 Ldler Views(80) Comments(0) Diggs(0) Edit
题目链接 思路:将字符串扩大两倍然后再用后缀数组排序后得出的sa数组判断得出答案 #include <iostream> #include <stdio.h> #include <cstring> #include <algorithm> using namespace std; #define M Read More
posted @ 2020-10-11 15:15 Ldler Views(52) Comments(0) Diggs(0) Edit