版本比较
题解 CF1073G 【Yet Another LCP Problem】
正文
增加 4 行删除 4 行
39 行未改动40414243444445464748143 行未改动全部展开192193194195196196197198199200149 行未改动全部展开35035135235335435435535635735839 行未改动398399400401402402403404405406137 行未改动全部展开39 行未改动
#### 代码 ####
```cpp// 后缀数组+分块 O(n sqrt(n) log sqrt(n)) // 后缀数组+分块 O(n sqrt(n) log sqrt(n))#include <cstdio>#include <cmath>#include <cstring>#include <algorithm>143 行未改动全部展开
#### 代码 ####
```cpp// 后缀数组+线段树 O(nlogn) // 后缀数组+线段树 O(nlogn)#include <cstdio>#include <cstring>#include <algorithm>using namespace std;149 行未改动全部展开 long long ans=0; st.build(1, 1, k); for (int i=1, j=1; i<=l; i++) { st.update(1, lcp(b[i], b[i-1])); st.update(1, lcp(b[i], b[i-1])); while (j<=k&&rnk[a[j]]<=rnk[b[i]]) st.change(1, j, lcp(b[i], a[j])), j++; ans+=st.query(1); }39 行未改动
#### 代码 ####
```cpp// 后缀数组+单调栈 O(nlogn) // 后缀数组+单调栈 O(nlogn)#include <cstdio>#include <cstring>#include <algorithm>using namespace std;137 行未改动全部展开