05 2024 档案
扫描线模板
摘要:#include<bits/stdc++.h> using namespace std; using i64 = long long; const int N = 1e6 + 5; //本模板是从左往右扫的,从下往上扫同理 #define ls (rt<<1) #define rs (rt<<1|1
线段树模板
摘要:#define lc u<<1 #define rc u<<1|1 const int N = 1e5 + 5; i64 w[N], n, m, p; struct Tree { //线段树 i64 l, r, sum, add, mul; } tr[N * 4]; void cal_lazy(i6
珂朵莉树/颜色段均摊
摘要:名称简介 珂朵莉树(Chtholly Tree),又名老司机树 ODT(Old Driver Tree)。起源自 CF896C。 注意,这种想法的本质是基于数据随机的「颜色段均摊」,而不是一种数据结构,下文介绍的操作是这种想法的具体实现方法。 前置知识 会用 STL 的 set 就行。 核心思想 把
压位高精度模板
摘要:struct BigInteger { static const int BASE = 100000000; static const int WIDTH = 8; vector<int> s; BigInteger(long long num = 0) { *this = num; } BigIn
Exgcd 模板
摘要:Exgcd 模板 pair<int, int> exgcd(int a, int b) { if (b == 0)return make_pair(1, 0); auto [x, y] = exgcd(b, a % b); pair<int, int> ans = make_pair(y, x -