摘要: 线段树 ///线段树,建树O(nlogn)、修改查询O(logn),单点修改、区间查询 //需要魔改内部的,就把泛型删掉 template<class T, class F> class SegmentTree { const int n; vector<T> node; void update(i 阅读全文
posted @ 2022-11-27 15:49 空白菌 阅读(39) 评论(0) 推荐(0) 编辑
摘要: 并查集 ///并查集(路径压缩),修改查询O(logn),用于维护集合关系 struct DSU { vector<int> fa; explicit DSU(int n):fa(n + 1) { for (int i = 1;i <= n;i++) fa[i] = i; } void init(i 阅读全文
posted @ 2022-11-27 15:19 空白菌 阅读(24) 评论(0) 推荐(0) 编辑