摘要:
点击查看代码 #include<bits/stdc++.h> using namespace std; const int N=1e5+10,null=0x3f3f3f3f; int h[N]; int find(int x) { int t=(x%N+N)%N; while(h[t]!=null& 阅读全文
摘要:
点击查看代码 #include<bits/stdc++.h> using namespace std; const int N=1e5+10; int n,m; int p[N]; bool st[N]; int find(int x) { if(p[x]!=x) p[x]=find(p[x]); 阅读全文
摘要:
点击查看代码 #include<bits/stdc++.h> using namespace std; const int N=1e5+10; int n,m,ans; int p[N]; bool st[N]; int find(int x) { if(p[x]!=x) p[x]=find(p[x 阅读全文
摘要:
点击查看代码 #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 阅读全文
摘要:
点击查看代码 #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 阅读全文
摘要:
点击查看代码 //最小循环节问题,实质也就是模板的简单变形了 //可以反过来推导一串字符cabca平移多长才能再使得之后的头和原先的尾重合,答案就是平移最小循环节的长度,因为最小循环节就是最小不重复片段,越过了最小不重复片段就可以相等了 #include<bits/stdc++.h> using n 阅读全文
摘要:
点击查看代码 #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 阅读全文