- 博客(54)
- 收藏
- 关注
原创 RMQ在线求LCA
#include<bits/stdc++.h>using namespace std;#define begin Begin#define next Next#define rank Rank#define REP(i, a, b) for (int i = (a), _end_ = (b); i <= _end_; ++i)#define ER(i, a) for (int i = begi
2016-08-16 17:17:22
670
1
原创 SGU102 欧拉函数 傻逼题
此题就是利用欧拉函数的性质求快速欧拉函数值Woc,辣鸡数据直接枚举都Accept啊#include <bits/stdc++.h>using namespace std;#define REP(i ,a, b) for (int i = (a), _end_ = (b); i <= _end_; ++i)#define debug(...) fprintf(stderr, __VA_ARGS__)
2016-08-11 16:48:57
559
原创 SGU101 欧拉回路 弱智水题
开始版刷SGU啦,SGU的题都是几十个点一道。。。MD一道题卡死你#include <bits/stdc++.h>using namespace std;#define begin Begin#define next Next#define count Count#define REP(i, a, b) for (int i = (a), _end_ = (b); i <= _end_; ++i
2016-08-09 17:10:03
398
原创 Radix-2 迭代FFT
#include <bits/stdc++.h>using namespace std;#define REP(i, a, b) for (int i = (a), _end_ = (b); i <= _end_; ++i)#define debug(...) fprintf(stderr, __VA_ARGS__)#define mp make_pair#define x first#de
2016-08-07 16:36:04
1032
原创 Radix-2 分治FFT
#include <bits/stdc++.h>using namespace std;#define REP(i, a, b) for (register int i = (a), _end_ = (b); i <= _end_; ++i)#define debug(...) fprintf(stderr, __VA_ARGS__)const int dmax = 300100, oo = 0x
2016-08-05 23:26:13
799
原创 BZOJ2049 洞穴勘测 LCT
#include <stdio.h>#include <stdlib.h>#include <string.h>#include <iostream>#include <algorithm>#include <set>#include <map>#include <stack>#include <queue>#include <vector>using namespace std;
2016-07-31 11:36:10
453
1
原创 BZOJ2002-弹飞绵羊 LCT
#include <stdio.h>#include <stdlib.h>#include <string.h>#include <iostream>#include <algorithm>#include <set>#include <map>#include <stack>#include <queue>#include <vector>using namespace std;
2016-07-31 01:13:29
266
原创 HDU4010 LCT
#include <stdio.h>#include <stdlib.h>#include <string.h>#include <iostream>#include <algorithm>#include <set>#include <map>#include <stack>#include <queue>#include <vector>using namespace std;
2016-07-30 15:56:28
360
原创 动态树 Link Cut Tree
#include <stdio.h>#include <stdlib.h>#include <string.h>#include <iostream>#include <algorithm>#include <set>#include <map>#include <stack>#include <queue>#include <vector>using namespace std;
2016-07-30 15:51:27
317
原创 Rank-Tree带动态查询删除 Splay
#include <bits/stdc++.h>using namespace std;#define REP(i, a, b) for (int i = (a), _end_ = (b); i <= _end_; ++i)#define debug(...) fprintf(stderr, __VA_ARGS__)#define mp make_pair#define x first#de
2016-07-28 00:12:41
266
原创 HDU1754 Splay 区间维护
#include <stdio.h>#include <stdlib.h>#include <string.h>#include <iostream>#include <algorithm>#include <set>#include <map>#include <stack>#include <queue>#include <string>#include <vector>us
2016-07-26 09:34:29
280
原创 Splay 区间维护模板
Warning: Splay常数较大,不是很适合RMQ之类的数据特别大的区间查询,Splay功能、灵活性首屈一指,比较适合有区间更新的题目#include <bits/stdc++.h>using namespace std;#define REP(i, a, b) for (int i = (a), _end_ = (b); i <= _end_; ++i)#define debug(.
2016-07-26 09:02:30
282
原创 主席树 (函数式线段树)
#include<algorithm>#include<iostream>#include<cstdio>using namespace std;const int maxn = 100000 + 10;struct node { int l, r, w; node(int l=0, int r=0, int w=0): l(l), r(r), w(w) {}}T[maxn
2016-07-08 22:06:41
346
原创 POJ3321 线段树水题
#include <stdio.h>#include <stdlib.h>#include <string.h>#include <iostream>#include <algorithm>#include <set>#include <map>#include <stack>#include <queue>#include <vector>using namespace std;#defi
2016-05-29 23:25:46
968
原创 POJ3468 线段树 + Lazy Tag (延迟标记)
#include <stdio.h>#include <stdlib.h>#include <string.h>#include <iostream>#include <algorithm>#include <set>#include <map>#include <stack>#include <queue>#include <vector>using namespace std;
2016-05-28 20:31:06
646
1
原创 树链剖分 (LCT基础)
#include using namespace std;#define REP(i, a, b) for (int i = (a), _end_ = (b); i <= _end_; ++i)#define RREP(i, a) for (int i = first[a]; i > 0; i = next[i])#define debug(...) fprintf(stderr,__
2016-04-08 00:10:54
450
原创 SBT平衡树
#include <bits/stdc++.h>using namespace std;#define REP(i, a, b) for (int i = (a), _end_ = (b); i <= _end_; ++i)#define debug(...) fprintf(stderr, __VA_ARGS__)#define mp make_pair#define x first#define y second#define pb push_back#define SZ(x) (i
2016-04-04 17:24:55
504
原创 Splay平衡树 (LCT基础)
#includeusing namespace std;#define REP(i,j,k) for (int i = (j), _end_ = (k); i <= _end_; ++i)#define DREP(i,j,k) for (int i = (j), _start_ = (k); i >= _start_; --i)#define debug(...) fprintf(st
2016-04-04 14:00:21
347
原创 矩阵的基本变换 | Matrix
#includeusing namespace std;#define max(x,y) Max(x,y)#define min(x,y) Min(x,y)#define REP(i,j,k) for (int i=(j),_end_=(k);i<=_end_;++i)#define debug(...) fprintf(stderr,__VA_ARGS__)#define pb
2016-03-31 13:32:04
743
原创 Manacher 线性时间求最长回文串
#include<bits/stdc++.h>#define REP(i,j,k) for (i=(j);i<=(k);++i)#define max(x,y) ((x)>(y)?(x):(y))#define min(x,y) ((x)<(y)?(x):(y))using namespace std;const int dmax=100100;char s[dmax];int f[dmax];int main(){ int i,j,k,m,n=0; s[0]='$'; while
2016-03-11 23:27:48
233
原创 HDU1010 DFS+剪枝水题
#include<stdio.h>#include<stdlib.h>#include<string.h>#include<iostream>#include<algorithm>#define For(i,j,k) for (int i=j;i<=k;i++)#define update(x) (x=='X'?1:0)#define abs(x) ((x)>0?(x):-(x))using namespace std;const int dmax=1010,d[5][2]={{0,0}
2016-03-03 13:41:02
292
原创 HDU2222 AC自动机水题 (Trie图优化)
#include#include#include#include#include#define For(i,j,k) for (i=j;i<=k;i++)using namespace std;struct node{ int count,flag; bool r; struct node *next[26],*fa,*fail; node(){ co
2016-02-27 16:25:43
497
原创 AC自动机 (Trie图优化)
#include<stdio.h>#include<stdlib.h>#include<string.h>#include<iostream>#include<algorithm>#define For(i,j,k) for (i=j;i<=k;i++)using namespace std;const int dmax=1010;struct node{ int count,flag; struct node *next[26],*fa,*fail; char s1[110];
2016-02-26 13:34:22
1833
原创 USACO 4.2.1 网络流 最高标号预流推进(HLPP)
/*ID: shenxyy1TASK: ditchLANG: C++11*/#include<bits/stdc++.h>using namespace std;#define set(x) Set(x)#define REP(i,j,k) for (int i=(j),_end_=(k);i<=_end_;++i)#define DREP(i,j,k) for (int i=(j),_start_=(k);i>=_start_;--i)#define debug(...) fpri
2016-02-18 16:49:04
1163
原创 USACO 4.2.1 网络流 SAP
/*ID: shenxyy1TASK: ditchLANG: C++11*/#include<bits/stdc++.h>using namespace std; #define REP(i,j,k) for (int i = (j), _end_ =(k); i <= _end_; ++i)#define DREP(i,j,k) for (int i = (j), _start_ =(k); i >= _end_; --i)#define debug(...) fprintf(std
2016-02-17 17:24:47
338
原创 POJ2135 最小费用最大流
#include#include#include#include#include#define max(x,y) ((x)>(y)?(x):(y))#define min(x,y) ((x)<(y)?(x):(y))#define For(i,j,k) for (i=j;i<=k;i++)const int dmax=100100,INF=1000000000;int begi
2016-02-16 21:12:17
357
原创 POJ2400 KM最大匹配
#include#include#include#include#include#define For(i,j,k) for (i=j;i<=k;i++)using namespace std;const int dmax=1010,INF=100000000;int a[dmax][dmax],lx[dmax],ly[dmax],slack[dmax],d[dmax],ans,
2016-02-16 14:01:12
307
原创 USACO 4.2.1 网络流 Dinic
/*ID: shenxyy1PROG: ditchLANG: C++*/#include#include#include#include#include#define max(x,y) ((x)>(y)?(x):(y))#define min(x,y) ((x)<(y)?(x):(y))#define For(i,j,k) for (i=j;i<=k;i++)using
2016-02-16 00:42:11
323
原创 POJ3686 KM最大权匹配+高难度建图
#include<stdio.h>#include<stdlib.h>#include<string.h>#include<iostream>#include<algorithm>#define For(i,j,k) for (i=j;i<=k;i++)using namespace std;const int dmax=2750,INF=100000000;int a[dmax][dmax],slack[dmax],d[dmax];int lx[dmax],ly[dmax],nx,ny
2016-02-15 16:23:12
1589
原创 ZOJ1654 ZOJ那个___不让我过!
#include<stdio.h>#include<stdlib.h>#include<string.h>#include<iostream>#include<algorithm>#define For(i,j,k) for (i=j;i<=k;i++)using namespace std;const int dmax=1010;int a[dmax][dmax],c1[dmax][dmax],c2[dmax][dmax],b[dmax][dmax];int d[dmax],e,e1,
2016-02-14 17:47:31
366
原创 HDU2255 KM完备最大匹配
#include#include#include#include#include#define For(i,j,k) for (i=j;i<=k;i++)using namespace std;const int dmax=1010,INF=1000000000;int n,m,d[dmax],lx[dmax],ly[dmax],w[dmax][dmax],slack[dmax]
2016-02-13 16:57:35
6733
原创 HDU2222 AC自动机水题
#include#include#include#include#include#define For(i,j,k) for (i=j;i<=k;i++)using namespace std;const int dmax=100100;struct node{ int count,flag; struct node *next[26],*fail,*fa; node(){
2016-02-09 15:57:21
7690
原创 双向BFS模板
#include#include#include#include#includeusing namespace std;const int dmax=1010,d[5][2]={{0,0},{1,0},{0,1},{-1,0},{0,-1}};int a[dmax][dmax],p[dmax][dmax],ans[dmax][dmax];struct node{ int x,y
2016-02-09 15:22:18
7479
转载 Vim编辑器精通
转自:http://blog.csdn.net/niushuai666/article/details/7275406#vim的学习曲线相当的大(参看各种文本编辑器的学习曲线),所以,如果你一开始看到的是一大堆VIM的命令分类,你一定会对这个编辑器失去兴趣的。下面的文章翻译自《Learn Vim Progressively》,我觉得这是给新手最好的VIM的升级教程了,没有列举所有的命令,只是列举了那些最有用的命令。非常不错。——————————正文开始——————————你想以最快的速度学习人类
2016-02-07 15:29:34
432
原创 AC自动机模板
#include<stdio.h>#include<stdlib.h>#include<string.h>#include<iostream>#include<algorithm>#define For(i,j,k) for (i=j;i<=k;i++)using namespace std;const int dmax=1010;struct node{ int count,flag; struct node *next[26],*fa,*fail; char s1[110];
2016-02-07 01:24:20
7297
转载 AC自动机概述
目录(?)[-]AC自动机总结引言KMP算法多字符串匹配问题和Trie字典树AC自动机的介绍AC自动机的构造多串匹配对于 AC自动机的改进从自动机的角度理解时间复杂度分析题目分析结束语AC自动机总结0.引言: 由于大连现场赛的一道 AC自动机+ DP的题目(zoj3545 Rescue the Rabbit)被小媛同学推荐看 AC自
2016-02-06 22:24:49
778
转载 AC自动机入门
AC自动机简介: 首先简要介绍一下AC自动机:Aho-Corasick automation,该算法在1975年产生于贝尔实验室,是著名的多模匹配算法之一。一个常见的例子就是给出n个单词,再给出一段包含m个字符的文章,让你找出有多少个单词在文章里出现过。要搞懂AC自动机,先得有字典树Trie和KMP模式匹配算法的基础知识。KMP算法是单模式串的字符匹配算法,AC自动机是多模式串的字符匹配算
2016-02-02 23:56:04
1228
原创 POJ3461 字符串hash
//为了防止冲突,使用了双hash#include#include#include#include#include#define ull unsigned long longconst ull B=1e8+7,C=1e8+119;const int dmax=1000100;char s[dmax],s1[dmax];int hash(char *a,char *b){ i
2016-02-01 17:02:26
8508
1
原创 POJ3461 KMP快速字符串匹配
#include#include#include#include#includeusing namespace std;const int dmax=1000100;char s[dmax],p[dmax];int next[dmax];void get_next(char *p){ int k=-1,j=0,n=strlen(p); next[0]=-1; while
2016-02-01 15:43:36
7285
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人