摘要: 树状数组判断三元逆序对~ #include<bits/stdc++.h> using namespace std; const int maxn=1e6+14; int a[maxn]; int c[maxn*8]; long long l[maxn],r[maxn]; int lowbit (in 阅读全文
posted @ 2020-02-13 11:28 zlc0405 阅读(197) 评论(0) 推荐(0) 编辑
摘要: 用tarjan算法缩点~ #include<bits/stdc++.h> using namespace std; const int maxn=1e6+14; vector<int> g[maxn]; int N,M,x,y; int low[maxn]; int dfn[maxn]; int c 阅读全文
posted @ 2020-02-13 11:27 zlc0405 阅读(133) 评论(0) 推荐(0) 编辑
摘要: 建立后缀数组,遍历height数组找到连续大于len的最长子序列~ #include<bits/stdc++.h> using namespace std; const int maxn=1e7+14; char s[maxn]; int n; int rk[maxn]; int sa[maxn]; 阅读全文
posted @ 2020-02-13 11:24 zlc0405 阅读(176) 评论(0) 推荐(0) 编辑
摘要: 暴力搜索加剪枝~ #include<bits/stdc++.h> using namespace std; const int maxn=1014; string t; string s[maxn]; int pos[maxn],pos1[maxn]; int N; int nowLength; i 阅读全文
posted @ 2020-02-13 11:22 zlc0405 阅读(160) 评论(0) 推荐(0) 编辑
摘要: 网络流模板~ #include<bits/stdc++.h> using namespace std; const int maxn=1014; const int inf=1e9; queue<int> q; int M,N; int g[maxn][maxn]; int pre[maxn]; i 阅读全文
posted @ 2020-02-13 11:21 zlc0405 阅读(367) 评论(0) 推荐(0) 编辑
摘要: 背包问题,把任务按截止日期排序,再按背包问题处理~ #include<bits/stdc++.h> using namespace std; const int maxn=1e6+14; struct node { int c; int w; int ddl; }Node[maxn]; int dp 阅读全文
posted @ 2020-02-13 11:12 zlc0405 阅读(141) 评论(0) 推荐(0) 编辑
摘要: 按题意枚举每个点,建立缺少该点情况下的最小生成树,取权值最大的~ #include<bits/stdc++.h> using namespace std; const int maxn=1014; const int inf=1e9; int g[maxn][maxn]; int visit[max 阅读全文
posted @ 2020-02-13 11:11 zlc0405 阅读(158) 评论(0) 推荐(0) 编辑
摘要: A Good In C纯模拟题,用string数组读入数据,注意单词数量的判断 #include<bits/stdc++.h> using namespace std; const int maxn=1010; string a[27][8]; int main () { for (int i=1; 阅读全文
posted @ 2020-02-12 23:11 zlc0405 阅读(535) 评论(0) 推荐(0) 编辑
摘要: 按要求判断树的信息,考查对字符串的处理~ #include<bits/stdc++.h> using namespace std; const int maxn=1014; struct node { int data; node * left; node * right; }; void inse 阅读全文
posted @ 2020-02-12 23:08 zlc0405 阅读(183) 评论(0) 推荐(0) 编辑
摘要: 判断一棵树是否是红黑树,按题给条件建树,dfs判断即可~ #include<bits/stdc++.h> using namespace std; const int maxn=1010; struct node { int data; node * left=NULL; node * right= 阅读全文
posted @ 2020-02-12 23:06 zlc0405 阅读(101) 评论(0) 推荐(0) 编辑