摘要:
线段树合并板子 #include<iostream> #include<cstring> using namespace std; const int N =5e5+10,M =N*2; int nxt[M],hd[N],all=1,go[M],n,m; int dep[N],f[N][22],fa 阅读全文
摘要:
错位排列板子题,plus: 组合数取模 const int N=1e6; #define int long long const int mod =1e9+7 ; int n,m,D[N+3] ; #define ll long long ll inv[N+3]; int F[N+3] ; int 阅读全文
摘要:
要求O(1) 查找元素的存在 struct HashMap{ static const int Hash=999917,maxn=46340; int num,link[Hash],son[maxn+5],next[maxn+5],w[maxn+5]; int top,Stack[maxn+5]; 阅读全文
摘要:
矩阵快速幂 #include <iostream> #include <cmath> #include <algorithm> using namespace std; #define N 2 int mod; #define int long long struct matrix { int a[ 阅读全文