摘要: 点击查看代码 #include<bits/stdc++.h> using namespace std; const int N=8e5+10; char str[N]; int ne[N]; int main() { int n; string s; cin>>n>>s; //构造反转拼接字符串 f 阅读全文
posted @ 2025-11-30 23:26 AnoSky 阅读(6) 评论(0) 推荐(0)
摘要: 点击查看代码 #include<bits/stdc++.h> using namespace std; const int N=1e6; int n,m,idx; int cnt[N]; char str[N]; int son[N][26]; void insert(char* str) { in 阅读全文
posted @ 2025-11-30 17:05 AnoSky 阅读(5) 评论(0) 推荐(0)
摘要: 点击查看代码 //最小循环节问题,实质也就是模板的简单变形了 //可以反过来推导一串字符cabca平移多长才能再使得之后的头和原先的尾重合,答案就是平移最小循环节的长度,因为最小循环节就是最小不重复片段,越过了最小不重复片段就可以相等了 #include<bits/stdc++.h> using n 阅读全文
posted @ 2025-11-30 17:02 AnoSky 阅读(2) 评论(0) 推荐(0)
摘要: 点击查看代码 #include<bits/stdc++.h> using namespace std; const int N=1e6+10; char s1[N],s2[N]; vector<int> pos; int ne[N]; int main() { scanf("%s%s",s1+1,s 阅读全文
posted @ 2025-11-30 16:12 AnoSky 阅读(5) 评论(0) 推荐(0)
摘要: 点击查看代码 #include<bits/stdc++.h> using namespace std; const int N=5e6,M=1e3+10; int son[N][26]; char str[21]; //这个bitset变量实际上就是集合的一种变形,实现了一个二维数组,映射起来有点麻 阅读全文
posted @ 2025-11-30 14:13 AnoSky 阅读(5) 评论(0) 推荐(0)
摘要: 点击查看代码 #include<bits/stdc++.h> using namespace std; const int N=100010; int son[N][26],idx; int n,cnt[N]; char str[N]; string op; void insert(char *st 阅读全文
posted @ 2025-11-30 11:06 AnoSky 阅读(6) 评论(0) 推荐(0)
摘要: 点击查看代码 #include<bits/stdc++.h> using namespace std; bool check(int k,int n,const vector<vector<int> >& pos) { //枚举所有可以作为障碍区的起始位置 for(int r=0;r<=n-k;r+ 阅读全文
posted @ 2025-11-30 00:36 AnoSky 阅读(4) 评论(0) 推荐(0)