摘要: "P3181 [HAOI2016]找相同字符" 对一个串建SAM,另一个串在这上面跑,到达一点时,假设经过了$cnt$个点 计算这个串所有后缀产生的贡献就好了,直接暴力跑上去可能会超时,topsort预处理一下 cpp include include include include include 阅读全文
posted @ 2018-12-31 15:40 y2823774827y 阅读(132) 评论(0) 推荐(0) 编辑
摘要: "【SPOJ】Longest Common Substring II" 多个字符串求最长公共子串 还是将一个子串建SAM,其他字符串全部跑一边,记录每个点的最大贡献 由于是所有串,要对每个点每个字符串跑完后去最小值才是每个点的最终贡献 cpp include include include incl 阅读全文
posted @ 2018-12-31 12:07 y2823774827y 阅读(141) 评论(0) 推荐(0) 编辑
摘要: "【HDU4622】Reincarnation" 一眼似乎不可做,但发现$strlen(x)$很小,暴力$O(n^2)$预处理每个区间$(l,r)$,查询时$O(1)$输出就好了 cpp include include include include include typedef int LL; 阅读全文
posted @ 2018-12-31 10:15 y2823774827y 阅读(134) 评论(0) 推荐(0) 编辑