题目链接 \(Click\) \(Here\) 水题.利用\(Height\)的性质维护一个单调栈即可. #include <bits/stdc++.h> using namespace std; #define LL long long const int N = 1000010; int n, m = 1000000, q, s[N], sa[N], tp[N]; int rk[N], _rk[N], bin[N], height[N]; void base_sort () { for (…