板子
数论
1.求单数欧拉函数
2.拓展中国剩余定理
3.高斯消元
4.exgcd
5.线性求欧拉函数
6.矩阵乘法
7.lucas 定理
数据结构
-
WBLT
-
李超树
struct node {
double k, b;
}line[N];
double calc(int id, int pos) { return line[id].k * bx[pos] + line[id].b; }//bx 为离散化数组,值表示原本位置,下标表示离散化后位置
bool lesd(int x, int y,int pos) {
return calc(x, pos) < calc(y, pos);
}
struct lctree {
int a[N * 4];
void add(int p, int l, int r, int id) {
if (l == r) {
if (lesd(id, a[p], l)) a[p] = id;
return;
}
int mid = l + r >> 1;
if (lesd(id, a[p], mid)) swap(a[p], id);
if (lesd(id, a[p], l)) add(p * 2, l, mid, id);
if (lesd(id, a[p], r)) add(p * 2 + 1, mid + 1, r, id);
}
double qry(int p, int l, int r, int pos) {
double res = calc(a[p], pos);
if (l == r) return res;
int mid = l + r >> 1;
if (pos <= mid) res = min(res, qry(p * 2, l, mid, pos));//在左边
else res = min(res, qry(p * 2 + 1, mid + 1, r, pos));//在右边
return res;
}
}tree;
- 可持久化线段树