摘要:
#include<iostream> #include<cstring> using namespace std; const int N = 100010; const int M = N * 2;//边要存两次 int n; int e[M], ne[M], h[N], idx = 0; boo 阅读全文
摘要:
第一种 类似于上一个题目得变形 #include<iostream> using namespace std; const int N = 20; int n; char p[N][N]; bool col[N], dg[N*2], udg[N*2];//注意范围的设置 void dfs(int u 阅读全文
摘要:
开放寻址法 #include<iostream> #include<algorithm> #include<cstring> #include<string> using namespace std; const int N =200003,null=0x3f3f3f3f; int a[N]; in 阅读全文
摘要:
并查集模板 注意查找到后查找的节点直接连接根节点 #include<iostream> using namespace std; const int N = 100010; int p[N]; //关键记住find函数 int find(int a) { if (p[a] != a) p[a] = 阅读全文
摘要:
KMP算法 int n, m; cin >> n >> a + 1 >> m >> b + 1;这两行代码的意思是输入字符串a,b但是是从下标1开始输入的 可以按照此方式输入字符串,但是输出必须按照下标for循环输出,不能直接输出 //注意next数组是对于要匹配的串写的(短的串) 1 #inclu 阅读全文