![](https://img-blog.csdnimg.cn/20201014180756918.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
模板
大学要有梦想
求offer鸭
QQ:1257960165
展开
-
AC自动机模板
AC自动机判母串中出现几次子串的个数(hdu2222)#include<iostream>#include<queue>using namespace std;const int maxn = 500005;const int Max = 26;struct Trie{ int next[maxn][Max]; int fail[m...原创 2017-07-29 17:27:18 · 227 阅读 · 0 评论 -
树状数组模板
单点更新,区间查询#define lowbit(x) (x)&(-x)const int maxn=10005;int sum[10005];void add(int x,int val){ while(x<maxn) { sum[x]+=val; x+=lowbit(x); }}int query(in...原创 2018-02-28 22:18:33 · 96 阅读 · 0 评论 -
线段树模板
线段树维护最长区间长度(HDU - 1540)#include<iostream>#include<stdio.h>#include<cstring>#include<algorithm>using namespace std;const int maxn = 50005;#define ls l,m,rt<<1...原创 2018-02-28 22:28:54 · 130 阅读 · 0 评论 -
字符串模板
manacher算法const int maxn=1000010; char str[maxn];//原字符串 char tmp[maxn<<1];//转换后的字符串 int Len[maxn<<1]; //转换原始串 int INIT(char *st) { int i,len=strlen(st); tmp[0...原创 2018-02-28 22:33:35 · 124 阅读 · 0 评论 -
DancingLinks模板
地表最强DLX(必要时需对dancing进行修改)const int maxnode = 262500;const int maxn = 750;const int maxm = 350;const int inf = 0x3f3f3f;struct DLX{ int n, m, size; int U[maxnode], D[maxnode], R[maxn...原创 2018-02-28 22:38:10 · 204 阅读 · 0 评论