正文
增加 106 行删除 253 行
123455 行未改动11121314151617182 行未改动212223242526272829303132333435363790 行未改动128129130131132133134135136137138139140141142143144145109 行未改动全部展开255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504正在努力写!/fendou## 数据结构+ [CF438D](https://www.luogu.com.cn/problem/CF438D)5 行未改动每个数有效的 $\bmod$ 有 $\log$ 个,每次单点改最多增加 $\log$ 个,所以直接记录最大值,区间模时若最大值不小于要模的数就暴力递归,这是 $\log^2$ 的。:::+ [P8969](https://www.luogu.com.cn/problem/P8969):::info[sol]2 行未改动线段树 tag 优先级:先加一个数,再按 `popcount` 对应至某个数。$O(n \log n \log V)$。:::+ [P11721](https://www.luogu.com.cn/problem/P11721)待补。+ [P2824](https://www.luogu.com.cn/problem/P2824):::info[sol]直接做是困难的,考虑**二分**最后数的大小 $x$,每次把 $\ge x$ 的数赋为 $1$,$<x$ 的数赋为 $0$,排序就变成了区间求 $0$ 个数、区间赋值。$O(n \log n \log V)$。:::+ [P11945](https://www.luogu.com.cn/problem/P11945)90 行未改动那么总的建树的区间大小是 $O(n \ln n)$ 的,总时间复杂度 $O(n \ln n + n \log n)$。:::+ [P16362](https://www.luogu.com.cn/problem/P16362)待补。### 数(据结构)形结合这种题,自己写题解,没有本质区别啊(嘴硬贴大家的题解吧。+ [P14638](https://www.luogu.com.cn/problem/P14638):::info[sol]109 行未改动全部展开+ [P11364](https://www.luogu.com.cn/problem/P11364)待补。+ [P9058](https://www.luogu.com.cn/problem/P9058)待补。## DP/数数~~感觉以后再多点这个可以单独开啊。~~ 已经是这样了!+ [P12017](https://www.luogu.com.cn/problem/P12017)待补。+ [AT_abc422_f](https://www.luogu.com.cn/problem/AT_abc422_f)待补。+ [P6007](https://www.luogu.com.cn/problem/P6007)待补。+ [P1800](https://www.luogu.com.cn/problem/P1800)待补。+ [P8745](https://www.luogu.com.cn/problem/P8745)待补。+ [P6189](https://www.luogu.com.cn/problem/P6189)待补。+ [P3244](https://www.luogu.com.cn/problem/P3244)待补。+ [P7519](https://www.luogu.com.cn/problem/P7519)待补。+ [P3592](https://www.luogu.com.cn/problem/P3592)待补。+ [P6835](https://www.luogu.com.cn/problem/P6835)待补。+ [P5303](https://www.luogu.com.cn/problem/P5303)待补。+ [P7118](https://www.luogu.com.cn/problem/P7118)待补。+ [P8321](https://www.luogu.com.cn/problem/P8321)待补。+ [P2467](https://www.luogu.com.cn/problem/P2467)待补。+ [P4609](https://www.luogu.com.cn/problem/P4609)待补。+ [CF348D](https://www.luogu.com.cn/problem/CF348D)还有个 P11704,待补。+ [CF1585F](https://www.luogu.com.cn/problem/CF1585F)待补。+ [P12444](https://www.luogu.com.cn/problem/P12444)待补。+ [P15564](https://www.luogu.com.cn/problem/P15564)待补。+ [P16973](https://www.luogu.com.cn/problem/P16973)待补。+ [P14364](https://www.luogu.com.cn/problem/P14364)待补。+ [P14022](https://www.luogu.com.cn/problem/P14022)待补。+ [P5400](https://www.luogu.com.cn/problem/P5400)待补。+ [P8329](https://www.luogu.com.cn/problem/P8329)待补。+ [P6076](https://www.luogu.com.cn/problem/P6076)待补。+ [P16416](https://www.luogu.com.cn/problem/P16416)待补。+ [P10202](https://www.luogu.com.cn/problem/P10202)待补。+ [P8340](https://www.luogu.com.cn/problem/P8340)待补。+ [AT_arc165_e](https://www.luogu.com.cn/problem/AT_arc165_e)待补。+ [CF101E](https://www.luogu.com.cn/problem/CF101E)待补。+ [AT_xmascon22_f](https://www.luogu.com.cn/problem/AT_xmascon22_f)待补。+ [P16923](https://www.luogu.com.cn/problem/P16923)待补。## 数论+ [P3327](https://www.luogu.com.cn/problem/P3327)待补。+ [P6810](https://www.luogu.com.cn/problem/P6810)待补。+ [P16962](https://www.luogu.com.cn/problem/P16962)待补。+ [P5179](https://www.luogu.com.cn/problem/P5179)待补。## 贪心+ [P10238](https://www.luogu.com.cn/problem/P10238)待补。+ [P2102](https://www.luogu.com.cn/problem/P2102)待补。+ [P14015](https://www.luogu.com.cn/problem/P14015):::info[sol]有点强。突破口:把奇数位不是 `2` 的**反转**(`^=1`),即可把规则改为“每次可删掉相邻的不同数,`2` 是什么怎么删都可以”。这样就可以做了,怎么回事呢。最后剩下的一定是一坨**相同**的东西。分讨 $|t_0 - t_1|$ 和 $t_2$ 的关系即可。```cout<<(abs(p[0]-p[1])>p[2]?abs(p[0]-p[1])-p[2]:(abs(p[0]-p[1])+p[2])&1)<<"\n";```:::+ [P10731](https://www.luogu.com.cn/problem/P10731)待补。+ [AT_abc457_g](https://www.luogu.com.cn/problem/AT_abc457_g)待补。### 反悔贪心+ [P16279](https://www.luogu.com.cn/problem/P16279)待补。+ [P3045](https://www.luogu.com.cn/problem/P3045)待补。## 构造+ [P3540](https://www.luogu.com.cn/problem/P3540):::info[sol][here](https://www.luogu.com.cn/article/kgezpl3y).:::+ [P10644](https://www.luogu.com.cn/problem/P10644)待补。+ [P7124](https://www.luogu.com.cn/problem/P7124)lxl 讲课硬说是构造,那就是吧。待补。+ [P13695](https://www.luogu.com.cn/problem/P13695)待补。+ [P16902](https://www.luogu.com.cn/problem/P16902)待补。## 图论### 图论建模+ [P16443](https://www.luogu.com.cn/problem/P16443)待补。+ [P16458](https://www.luogu.com.cn/problem/P16458)待补。+ [P9140](https://www.luogu.com.cn/problem/P9140)待补。+ [AT_agc056_c](https://www.luogu.com.cn/problem/AT_agc056_c)待补。123455 行未改动1112131415161718192021222324252627282 行未改动313233343536373839404142434445464748495051525390 行未改动144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241109 行未改动全部展开351352353354355356357施工中!/fendou## 数据结构+ [CF438D](https://www.luogu.com.cn/problem/CF438D)5 行未改动每个数有效的 $\bmod$ 有 $\log$ 个,每次单点改最多增加 $\log$ 个,所以直接记录最大值,区间模时若最大值不小于要模的数就暴力递归,这是 $\log^2$ 的。:::+ [P5500](https://www.luogu.com.cn/problem/P5500):::info[sol]考虑离线,以 $r$ 从小到大排序。这个时候到某个询问,每种数最后出现的那个一定最优。所以双指针,用树状数组维护每种数最后出现的下标,就是一只 $\log$。:::+ [P8969](https://www.luogu.com.cn/problem/P8969):::info[sol]2 行未改动线段树 tag 优先级:先加一个数,再按 `popcount` 对应至某个数。$O(n \log n \log V)$。:::+ [P3616](https://www.luogu.com.cn/problem/P3616):::info[sol]刻画一下,**答案是 $\sum_{i=1}^n [a_{i-1}<x\le a_i]$。**那么树状数组即可。:::+ [P11721](https://www.luogu.com.cn/problem/P11721):::info[sol]按时刻建线段树。在每个节点维护一个 `vector`,从左到右存做了这个区间的操作之后,对应的 $k,b$ 不同的每个段(每个操作只会贡献 $\log$ 个段)。一个节点满了再 `up`,然后查询在 $\log$ 个 `vector` 上二分,就是 $\log^2$ 的。:::+ [P11945](https://www.luogu.com.cn/problem/P11945)90 行未改动那么总的建树的区间大小是 $O(n \ln n)$ 的,总时间复杂度 $O(n \ln n + n \log n)$。:::+ [P4635](https://www.luogu.com.cn/problem/P4635):::info[sol][here](https://www.luogu.com.cn/article/ykjr1gmy).:::+ [P16362](https://www.luogu.com.cn/problem/P16362)待补。+ [P7897](https://www.luogu.com.cn/problem/P7897)待补。+ [P7124](https://www.luogu.com.cn/problem/P7124):::info[sol]考虑在 $\text{dfn}$ 序列上分治。每次 $[l,mi][mi+1,r]$,有一些点的子树会横跨 $mi$,由于这是 $\text{dfn}$,所以这些点是一条链上的,则子树区间必然互相包含。从里到外加,之后全删掉,再递归 $[l,mi]$ 和 $[mi+1,r]$ 即可。:::+ [P16702](https://www.luogu.com.cn/problem/P16702):::info[sol]单侧递归,好玩的。[here](https://www.luogu.com.cn/article/h2xwxb5n).:::+ [P12401](https://www.luogu.com.cn/problem/P12401):::info[sol]考虑 $v_i,v_{N-i+1}$ 这样一对会导致哪些 $[A,B]$ 不合法。设 $v_i \le v_{N-i+1}$,那么就是与 $[v_i + 1 , v_{N-i+1}]$ 有交的 $[A,B]$。考虑对于每一对,在区间上覆盖。那么就要维护区间中所有值都为零的子区间个数,区间加。线段树维护区间最小值、区间中所有值都为区间最小值的子区间个数即可。:::+ [P10071](https://www.luogu.com.cn/problem/P10071)待补。+ [P8529](https://www.luogu.com.cn/problem/P8529):::info[sol]lxl 老师省集讲的半平面莫队,牛的。[here](https://www.luogu.com.cn/article/cc9aop2b).:::+ [P7560](https://www.luogu.com.cn/problem/P7560):::info[sol]先考虑算出白嫖事件送给的是从最开始算,加入这个点的第几个人。一个线段树区间加区间对 $0$ 取 $\max$ 维护每个点当前人数,一个树状数组维护每个点加入的总人数。到白嫖事件,求得这两个分别为 $a,b$。若 $a \ge k$,则有人被赠送,她是从最开始算,加入这个点的第 $b-a+k$ 个人。算出来之后,在时间轴上面整体二分即可。:::+ [P10764](https://www.luogu.com.cn/problem/P10764)待补。+ [P14447](https://www.luogu.com.cn/problem/P14447)待补。### 数(据结构)形结合+ [P14638](https://www.luogu.com.cn/problem/P14638):::info[sol]109 行未改动全部展开+ [P11364](https://www.luogu.com.cn/problem/P11364)待补。## 一种可恶的东西先放两个[题](https://www.luogu.com.cn/training/1083117)[单](https://www.luogu.com.cn/training/1081975)。