
模板
squee_spoon
这个作者很懒,什么都没留下…
展开
-
模板-后缀数组
#include#include#includeusing namespace std;const int Max = 20001;int num[Max];int sa[Max], rank[Max], height[Max];int wa[Max], wb[Max], wv[Max], wd[Max];int cmp(int *r, int a, int b, int l原创 2014-10-23 19:59:08 · 537 阅读 · 0 评论 -
模板-树链剖分
#define MAXN 50010 #define L(u) (u<<1) #define R(u) (u<<1|1) //写在类里面爆栈 int n, m, q; int tim; //时间戳 int num[MAXN]; //树上每个节点的初始值 int siz[MAXN]; //siz[u]表示以u为根的子树的节点数 int top[MAX原创 2014-11-24 23:38:29 · 609 阅读 · 0 评论 -
模板--DLX
struct DLX{ int n,sz; int S[maxn]; int row[maxnode],col[maxnode]; int L[maxnode],R[maxnode],U[maxnode],D[maxnode]; int ansd,ans[maxn]; void init(int n){ this->n=n; for(int i=0;i<=n;i++){原创 2014-12-01 06:28:09 · 623 阅读 · 0 评论 -
模板-Dinic
#define INF 100000010 #define maxn 210 struct Edge{ int u; int v; int cap; int flow; Edge(int u,int v,int c):u(u),v(v),cap(c),flow(0){} Ed原创 2014-11-22 18:36:57 · 523 阅读 · 0 评论 -
模板-高斯消元(hihocoder 1195)
高斯消元裸题,存为模板吧。值得注意的是精度1e-8、1e-10过不去,但是1e-6能过,据说每次找最大的行消元可以减小误差。#include #include #include #include #include #include #include #include using namespace std;const double eps = 1e-6; /原创 2015-08-05 22:11:53 · 551 阅读 · 0 评论 -
模板-KM算法
#include <bits/stdc++.h>using namespace std;const int maxn = 66;const int maxN = 410;int lx[maxN];int ly[maxN];int sx[maxN];int sy[maxN];int match[maxN];int weight[maxN][maxN];int sz;bool path(i原创 2016-04-29 23:41:36 · 509 阅读 · 0 评论 -
快速傅里叶变换(FFT)
首先说一下我用FFT做什么,我要做的是多项式乘法,或者说,加速多项式乘法。 考虑多项式A(x)=∑j=0n−1ajxjA(x)=\sum\limits_{j=0}^{n-1}a_jx^j,它一共有nn项,我们称它的次数界为nn。假设我们有两个次数界为nn的多项式A(x)A(x)和B(x)B(x),要求它们的和是非常简单的,只需要将对应的系数相加,复杂度为O(n)O(n)。如果要求他们的积,则需原创 2016-05-21 09:10:23 · 822 阅读 · 0 评论 -
(中国剩余定理模版)hdoj 5768 Lucky7
解(1<<(n+1))-1个同余方程组,然后容斥。作为中国剩余定理的模版。#include <iostream> #include <stdio.h> #include <cmath> #include <algorithm> #include <string> #include <string.h> #include <vector> #i原创 2016-07-29 21:55:22 · 452 阅读 · 0 评论