版本比较
HDU 多校 2023 Round #6 题解
正文
增加 2 行删除 2 行
611 行未改动全部展开612613614615616617618619620367 行未改动全部展开98898999099199299399499599657 行未改动611 行未改动全部展开dp_{l,r}=-\min\left\{\min_{k=l+1}^{mid}dp_{k,r}\ ,\ \min_{k=mid}^{r-1} dp_{l,k}\right\}$$注意到转移过程中,同一个 $dp_{l,*}$,所询问的区间一定是向右单调的,单调队列优化即可,$dp_{*,r}$ 同理维护即可。时间复杂度 $\mathcal O(n^2)$。**代码呈现**```cpp367 行未改动全部展开int r=++tot;tr[r]=tr[q],tr[r].len=tr[p].len+1;tr[q].link=tr[cur].link=r;while(p&&tr[p].ch[c]==q) tr[p].ch[c]=r,p=tr[p].link;}}return lst=cur;}vector <int> G[MAXN<<1];57 行未改动611 行未改动全部展开612613614615616617618619620367 行未改动全部展开98898999099199299399499599657 行未改动611 行未改动全部展开dp_{l,r}=-\min\left\{\min_{k=l+1}^{mid}dp_{k,r}\ ,\ \min_{k=mid}^{r-1} dp_{l,k}\right\}$$注意到转移过程中,同一个 $dp_{l,*}$,所询问的区间一定是向右单调的,单调队列优化即可,$dp_{*,r}$ 同理维护即可。时间复杂度 $\mathcal O(n^2)$。**代码呈现**```cpp367 行未改动全部展开int r=++tot;tr[r]=tr[q],tr[r].len=tr[p].len+1;tr[q].link=tr[cur].link=r;while(p&&tr[p].ch[c]==q) tr[p].ch[c]=r,p=tr[p].link;}}return lst=cur;}vector <int> G[MAXN<<1];57 行未改动