摘要: bitset优化 bitset复杂度可以达到 \(O(n/32)\) ,一定程度上可以 \(n^2\) 过 \(10^5\) 。 例题CodeForces - 914F 题目问题在于统计 \(10^5\) 个 \(10^5\) 数量级的字符串匹配,传统字符串哈希或kmp只能做到 \(O(n^2)\) 阅读全文
posted @ 2025-08-17 20:06 allenyuan9038074 阅读(18) 评论(0) 推荐(0)
摘要: CF1827C 此题要求 \(S\) 中美丽子串的数量。考虑枚举每个美丽子串的起始点为 \(i\),因为大回文串可以分解成小回文串,所以提前处理记录以每个点 \(i\) 为起点的最小回文串大小为 \(nxt_i\)。然后以 \(i\) 为起点扩展到 \(i+nxt_i\),然后递归处理到 \(i > 阅读全文
posted @ 2025-08-17 15:30 allenyuan9038074 阅读(16) 评论(0) 推荐(0)
摘要: Manacher Manacher 是一种 \(O(n)\) 的回文串查找方式. 朴素算法 长度为 \(n\) 的字符串最多有 \(n^2\) 个回文子串. 朴素算法枚举回文串的中心。朴素算法复杂度为 \(O(n^2)\) . int find(string s){ for (int i=0;i<s 阅读全文
posted @ 2025-08-17 15:07 allenyuan9038074 阅读(30) 评论(0) 推荐(0)
摘要: Manacher Manacher 是一种 \(O(n)\) 的回文串查找方式. 朴素算法 长度为 \(n\) 的字符串最多有 \(n^2\) 个回文子串. 朴素算法枚举回文串的中心。朴素算法复杂度为 \(O(n^2)\) . int find(string s){ for (int i=0;i<s 阅读全文
posted @ 2025-08-17 15:01 allenyuan9038074 阅读(10) 评论(0) 推荐(0)