摘要: "题目链接" 建出$sam$,求出parent tree上每个点的$endpos$集合大小。 如果等于$k$,说明到达这个点的都可以。给$(len[fa(i)],len[i]]$的$cnt$都加$1$,差分即可。 cpp include include include using namespace 阅读全文
posted @ 2019-06-16 12:01 Qihoo360 阅读(331) 评论(0) 推荐(0) 编辑
摘要: "题目链接" 广义sam+不同子串个数。。 找到所有入度为$0$的点开始$dfs$,建出广义sam。 然后就是 "不同子串个数" 了 cpp include include include using namespace std; const int MAXN = 1000010; struct S 阅读全文
posted @ 2019-06-16 10:58 Qihoo360 阅读(136) 评论(0) 推荐(0) 编辑
摘要: "题目链接" 广义sam。。 cpp include include include using namespace std; const int MAXN = 1000010; struct SAM{ int ch[26]; int len, fa; }sam[MAXN 阅读全文
posted @ 2019-06-16 10:12 Qihoo360 阅读(162) 评论(0) 推荐(0) 编辑
You're powerful!