随笔分类 - 代码模板
一些代码模板
摘要:支持双端插入的可撤销回文自动机 打多校看到的科技,板子++ 参考来源:https://ac.nowcoder.com/acm/contest/view-submission?submissionId=53195473 template <class T, int SIZE, T offset> st
阅读全文
摘要:如何求树上最近公共祖先LCA 求树上最近公共祖先一般常用的有三种方法 预处理时间复杂度 查询时间复杂度 树上倍增 \(O(nlogn)\) \(O(logn)\) 树链剖分 \(O(n)\) \(O(logn)\) 欧拉序+ST表 \(O(nlogn)\) \(O(1)\) 在一般的使用情景下,前两
阅读全文
摘要:#ST表 ST表是一种能用来处理静态区间最大值(最小值其实也行)问题的数据结构 预处理时间复杂度O(nlogn),查询时间复杂度O(1) #includebits/stdc++.h> using namespace std; const int maxn = 100000; int ST[maxn]
阅读全文
摘要:树状数组基本模板 lowbit 1 inline int lowbit(int x) 2 { 3 return x & (-x); 4 } 单点修改 1 inline void update(int i, int x) 2 { 3 for (int pos = i; pos < MAXN; pos
阅读全文

浙公网安备 33010602011771号