摘要: manacher算法 char org[maxn],S[maxn]; int p[maxn]; inline int manacher() { S[0]='$'; S[1]='#'; int len=2; int L=strlen(org); for(int i=0;i<L;i++) { S[len 阅读全文
posted @ 2016-07-26 21:10 wust_ouyangli 阅读(152) 评论(0) 推荐(0) 编辑
摘要: Dinic算法 #include<cstdio> #include<cstring> #include<string> #include<queue> #include<algorithm> #include<vector> using namespace std; const int INF=1e 阅读全文
posted @ 2016-07-26 10:00 wust_ouyangli 阅读(176) 评论(0) 推荐(0) 编辑
摘要: 代码 #include<cstdio> #include<cstring> #include<string> #include<algorithm> using namespace std; const int maxn=1005; int wa[maxn],wb[maxn],wv[maxn],WS 阅读全文
posted @ 2016-07-26 09:55 wust_ouyangli 阅读(113) 评论(0) 推荐(0) 编辑
摘要: 题意很直观,我就不说了。 解析:这是我以前没有接触过的线段树类型,有序表线段树,每个节点申请了两段空间,主要是为了保存左边儿子会有多少比v小的,右边儿子会有多少比v小 的,所以在建树过程中要归并排序。可能我讲起来比较难懂,详见代码,我给了注释。 代码 #include<cstdio> #includ 阅读全文
posted @ 2016-07-26 09:48 wust_ouyangli 阅读(338) 评论(0) 推荐(1) 编辑
摘要: 题意我就不说了 解析: 莫队,先预处理出以i为右端点的区间的gcd值,有一些连续的区间的gcd值是相同的,比如[j,i],[j+1,i],[j+2,i]的gcd值是相同的,我们可以把[j,j+2]这个 区间保存下来。同时也预处理出以i为左端点的,最后用莫队算法。详见代码实现。 代码 #include 阅读全文
posted @ 2016-07-26 09:34 wust_ouyangli 阅读(144) 评论(0) 推荐(0) 编辑