摘要: 点击查看代码 //最小循环节问题,实质也就是模板的简单变形了 //可以反过来推导一串字符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 阅读(3) 评论(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 阅读(4) 评论(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 阅读(4) 评论(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)
摘要: 点击查看代码 #include<bits/stdc++.h> using namespace std; const int N=1000010,M=2010; int n,m; int ans,cnt,ansl,ansr; int a[N],b[M]; inline void ins(int x) 阅读全文
posted @ 2025-11-27 00:34 AnoSky 阅读(4) 评论(0) 推荐(0)
摘要: 点击查看代码 #include<bits/stdc++.h> using namespace std; const int N=200010; //mxstk和stk始终保持相同的大小,记录的是从栈底到该位置的最大值,弹出的话不会将所有的最大值弹出,如果最后一个加入的不是最大值的话那么前面的数依旧是 阅读全文
posted @ 2025-11-25 00:37 AnoSky 阅读(2) 评论(0) 推荐(0)
摘要: 点击查看代码 #include<bits/stdc++.h> using namespace std; const int N=500005; int l[N],r[N]; int n,m; bool del[N]; void insert(int x,int y) { r[x]=r[y],l[x] 阅读全文
posted @ 2025-11-24 23:53 AnoSky 阅读(9) 评论(0) 推荐(0)
摘要: 点击查看代码 #include<bits/stdc++.h> using namespace std; const int N=101; int n,m; int ne[N]; int main() { cin>>n>>m; if(!n&&!m) return 0; for(int i=1;i<n; 阅读全文
posted @ 2025-11-24 19:43 AnoSky 阅读(3) 评论(0) 推荐(0)
摘要: 点击查看代码 #include<bits/stdc++.h> using namespace std; const int N=1000010; int e[N],ne[N],idx,head=-1; int pos[N]; //此题的关键是查询数值,需要根据数值来查询到一个元素的后面一个元素是什么 阅读全文
posted @ 2025-11-24 10:37 AnoSky 阅读(16) 评论(0) 推荐(0)