随笔分类 - template
算法模板
摘要:模拟退火适用范围:寻找最优解,估价函数复杂度小,状态巨大。所以它也不是万能的。
阅读全文
摘要:Tarjan 与图的连通性的全家桶!!!包括:缩点、点双、边权、圆方树、2-sat
阅读全文
摘要:虚树,是原树的一种子树,只储存和关键点有关的信息,时空复杂度做到均摊。
阅读全文
摘要:posted on 2021-11-19 15:41:01 | under 模板 | source posted on 2021-06-12 09:53:53 | under 学术 | source posted on 2022-07-30 14:50:21 | under 模板 | source
阅读全文
摘要:2025.2.7 添加内容 参考文献:题解 P4717 【【模板】快速莫比乌斯/沃尔什变换 (FMT/FWT)】 - 洛谷专栏 下文不区分 FWT 和 FMT 而统一称作 FWT。 目录题目描述卷积运算律三种卷积按位异或卷积按位或卷积按位与卷积线性性矩阵形式FWT 是系数转点值快速修改系数按位独立性
阅读全文
摘要:线段树大杂烩,然而线段树的题难点都不在线段树()
阅读全文
摘要:一棵树,点上有一些**满足结合律**的信息,$m$ 次询问求出一条链上的点权之“和”,允许**离线**。$n,m\leq 10^5$。似乎有 $O(n\alpha(n))$ 的做法。
阅读全文
摘要:posted on 2021-07-10 20:33:18 | under 题解 | [source](https://www.luogu.com.cn/blog/_post/348063) 非常经典的求逆序对个数问题。An inversion is a pair of indices $(i,j)
阅读全文
摘要:\(pa_i\) 表示以 \(i\) 为中心的(原串的)回文串长度 点击查看代码 #include <cstdio> #include <cstring> #include <algorithm> using namespace std; typedef long long LL; int n,m,
阅读全文
摘要:posted on 2021-02-25 18:23:15 | under 学术 | source 数组 #include <cstdio> #include <cstring> #include <algorithm> using namespace std; template<int N> st
阅读全文
摘要:posted on 2022-08-12 14:14:05 | under 模板 | source 感谢讲师 LQS 带来的网络流专题。 本文非常不严谨,请不要把它当作入门博客。 codes 最大流:Dinic 实现(version 1) typedef long long LL; template
阅读全文
摘要:posted on 2022-10-15 16:45:09 | under 题解 | source 什么是李超线段树? 李超线段树是一种可以插入直线,单点查询 $\min/\max$ 的线段树,用了标记永久化的技巧。 修改时一路走下去,最多递归一边,啥都不用管。 李超线段树除了全局插入直线,单点询问
阅读全文
摘要:posted on 2021-11-16 12:50:02 | under 模板 | source ~~英语不好啊,就叫 treecut 吧,不管了~~ treecut 速成(确信): 重儿子:所有儿子节点中 siz 最大的。重链:以轻儿子(钦定 root 为轻儿子)开始一直往重儿子走的一条链。 d
阅读全文
摘要:posted on 2021-08-27 19:17:02 | under 模板 | source 万恶之源:初赛完善程序 一些定义: #include <cstring> #include <algorithm> using namespace std; const int maxn=1e5,ma
阅读全文
摘要:posted on 2022-07-22 15:16:41 | under 模板 | source 离散花 template<int N> struct flower{ int b[N+10],cnt; flower():cnt(0){} void operator+=(int x){b[++cnt
阅读全文
摘要:posted on 2021-09-04 20:03:43 | under 模板 | source 点击查看代码 template <int N, int M, class T> struct graph { int head[N + 10], nxt[M << 1], cnt; struct ed
阅读全文
摘要:posted on 2022-07-21 14:10:58 | under 模板 | source typedef long long LL; template<int N> struct fhqtreap{ int val[N+10],pri[N+10],siz[N+10],x,y,z,root;
阅读全文
摘要:posted on 2021-08-17 09:15:04 | under 模板 | source 可清空 template<int N> struct fenwick{ int t[N + 10]; fenwick() { memset(t, 0, sizeof t); } void add(in
阅读全文
摘要:posted on 2022-08-07 17:04:40 | under 模板 | source 目录后缀数组code证明 \(rnk_{sa_i+j}\) 只会越界到 \(n+1\)证明解决方法构造数据求两个后缀的 LCP求 \(S[l,r]\) 在原串的出现次数本质不同的子串个数(位置不同算相
阅读全文
摘要:posted on 2022-08-07 20:50:14 | under 模板 | source updated on 20230727:增补更多细节,合并广义 SAM 相关。 点击查看闲话 广义后缀自动机,建议看这篇理解会更深(口语化警告) <- 已经加入后缀自动机豪华套餐 保存:基本子串结构
阅读全文