Loading

摘要: 字符串哈希 对于两个字符串 \(s,t\),如果要判断其是否相等,则需要分别比较每一个字符。而使用哈希函数将字符串映射可以更方便地完成判断。 有哈希函数 \(f(s)\),我们希望: 当 \(f(s)\neq f(t)\) 时,\(s\neq t\)。 当 \(f(s)=f(t)\) 时,\(s\) 阅读全文
posted @ 2026-04-17 23:41 Seqfrel 阅读(0) 评论(0) 推荐(0)
摘要: 指一类求解区间信息的 DP。通常以 \(f_{l,r}\) 表示区间 \([l,r]\) 的状态。 求解过程:枚举区间 \(\rightarrow\) 枚举分割点,将该区间分割为两个小区间 \(\rightarrow\) 合并小区间,转移得到大区间 \(\rightarrow\) 统计答案。 因为在 阅读全文
posted @ 2026-04-16 23:49 Seqfrel 阅读(8) 评论(0) 推荐(0)
摘要: A - illegal 判断。 #include<bits/stdc++.h> using namespace std; int l; string s; int main(){ ios::sync_with_stdio(false); cin.tie(0),cout.tie(0); cin>>s; 阅读全文
posted @ 2026-03-29 00:08 Seqfrel 阅读(283) 评论(0) 推荐(1)
摘要: 动态维护前缀的数据结构。以下均以前缀和为例。 构造树状数组 对于长度为 \(n\) 的原始数组 \(A\),我们把元素两两合并,在此之上再把区间两两合并,直到合并到整个数组,把这些区间的和存下来构造辅助数组,即可以把每个区间拆成不超过 \(\log n\) 个区间,以达到快速修改单点和查询区间的目的 阅读全文
posted @ 2026-03-27 23:57 Seqfrel 阅读(11) 评论(0) 推荐(1)
摘要: 双连通分量 割边:无向图中,删除这条边会使图不连通的边(又叫桥)。 割点:无向图中,删除这个点会使图不连通的点。 边双连通:两点 \(u,v\) 间不存在割边,就称 \(u,v\) 边双连通。即:删去 \(u,v\) 间任意一边,\(u,v\) 仍然连通。 点双连通:两点 \(u,v\) 间不存在割 阅读全文
posted @ 2026-02-27 18:35 Seqfrel 阅读(9) 评论(0) 推荐(0)
摘要: 题意 给定一个长为 \(N\) 的区间,\(M\) 次区间推平操作。问区间上最后有多少个不同的值。 思路 离散化 区间可能有 \(10^7\) 这么长,但是只进行 \(1000\) 次推平操作。考虑对区间离散化,因为我们只关注区间端点的大小关系。但只离散化端点会造成一个问题:若一区间两端点都被其他区 阅读全文
posted @ 2026-02-26 11:58 Seqfrel 阅读(7) 评论(0) 推荐(1)
摘要: A - Strong Word 直接判。 #include<bits/stdc++.h> using namespace std; string s; int main(){ ios::sync_with_stdio(false); cin.tie(0),cout.tie(0); cin>>s; i 阅读全文
posted @ 2026-02-14 22:37 Seqfrel 阅读(102) 评论(0) 推荐(1)
摘要: A - Repdigit 直接判三个数字。 #include<bits/stdc++.h> using namespace std; string s; int main(){ ios::sync_with_stdio(false); cin.tie(0),cout.tie(0); cin>>s; 阅读全文
posted @ 2026-02-08 23:01 Seqfrel 阅读(39) 评论(0) 推荐(1)
摘要: A - Append s 模拟即可。 #include<bits/stdc++.h> using namespace std; string s; int main(){ ios::sync_with_stdio(false); cin.tie(0),cout.tie(0); cin>>s; cou 阅读全文
posted @ 2026-02-03 11:46 Seqfrel 阅读(15) 评论(0) 推荐(1)
摘要: A - Count . 直接模拟即可。 #include<bits/stdc++.h> using namespace std; string s; int ans; int main(){ ios::sync_with_stdio(false); cin.tie(0),cout.tie(0); c 阅读全文
posted @ 2026-02-01 19:33 Seqfrel 阅读(39) 评论(0) 推荐(1)