版本比较
MX青岛集训游记
正文
增加 69 行删除 1 行
53 行未改动5455565758585960616293 行未改动15615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622753 行未改动[P4246 [SHOI2008] 堵塞的交通](https://www.luogu.com.cn/problem/P4246)
[P4097 【模板】李超线段树 / [HEOI2013] Segment](https://www.luogu.com.cn/problem/P4097)
## D3## D3 #### 上午模拟赛
T1很简单,后面忘了 [T2](https://qoj.ac/problem/7937/statement/zh_cn) 93 行未改动
[CF1009F Dominant Indices](https://www.luogu.com.cn/problem/CF1009F) 长链剖分板子/dsu on tree板子 复杂度证明:对于每一条长链,仅当转移其链头时会被暴力计算,暴力计算的复杂度为$O(h[top])$即链头高度,又因为长链的链头高度等于链的长度,$len[i]$表示i链的长度,总复杂度即为$O(\sum len[i])=O(n)$
## D92个最短路板子不放了
[P1462 通往奥格瑞玛的道路](https://www.luogu.com.cn/problem/P1462) 二分+最短路
[P4568 [JLOI2011] 飞行路线](https://www.luogu.com.cn/problem/P4568) 分层图+最短路
[AT_arc084_b [ABC077D] Small Multiple](https://www.luogu.com.cn/problem/AT_arc084_b) 0/1BFS求最短路,同余最短路
[P2371 [国家集训队] 墨墨的等式](https://www.luogu.com.cn/problem/P2371) 任取一个a[i]设为m。定义f[i]表示当%m=i时,b能取到的最小值,显然f[0]=0,跑一遍最短路再统计答案就完事了。
[P6880 [JOI 2020 Final] 奥运公交 / Olympic Bus](https://www.luogu.com.cn/problem/P6880) 在原图跑一边Dijkstra,反图中跑一遍,然后在原图和反图中各建一棵最短路树,枚举每一条边。时间复杂度为$O(1)$。 若这条边不在树上,则反转这条边后的总代价为$\min(dis[1][n],dis[1][v]+disf[n][u]+w)+\min(dis[1][n],dis[n][v]+disf[1][u]+w)+d$,其中dis[i][j]表示原图中从i到j的最短路,disf[i][j]表示反图中从i到j的最短路等价于原图中从j到i的最短路。 若这条边在树上,则重新跑一遍dijstra,计算1到n的答案。时间复杂度为$O(n^2)$ 一棵树上有$n-1$条边,则dijkstra要跑$O(n)$次,则总复杂度为$O(n^3+m)$## D10[P3386 【模板】二分图最大匹配](https://www.luogu.com.cn/problem/P3386) [P3387 【模板】缩点 / 强连通分量](https://www.luogu.com.cn/problem/P3387) [P8435 【模板】点双连通分量](https://www.luogu.com.cn/problem/P8435) [P8436 【模板】边双连通分量](https://www.luogu.com.cn/problem/P8436)
[P3436 [POI 2006] PRO-Professor Szu](https://www.luogu.com.cn/problem/P3436) 拓扑dp一下就行了。
[CF1139E Maximize Mex](https://www.luogu.com.cn/problem/CF1139E) 从第d天到第1天,这样就变成了每天多一名学生,然后尝试当前mex+1能否匹配成功,若成功mex+=1,然后就做完了。
[P10953 逃不掉的路](https://www.luogu.com.cn/problem/P10953)用边双连通分量缩点,显然缩点后的图是一棵树且边都是必须经过的,然后lca求两点距离。
[P3469 [POI 2008] BLO-Blockade](https://www.luogu.com.cn/problem/P3469) 找割点,然后算一下方案数就行。
## D11模拟赛## D12[P5431 【模板】模意义下的乘法逆元 2](https://www.luogu.com.cn/problem/P5431) [P3807 【模板】卢卡斯定理 / Lucas 定理](https://www.luogu.com.cn/problem/P3807) [P4549 【模板】裴蜀定理](https://www.luogu.com.cn/problem/P4549) [P5656 【模板】二元一次不定方程 (exgcd)](https://www.luogu.com.cn/problem/P5656) [P1495 【模板】中国剩余定理(CRT)/ 曹冲养猪](https://www.luogu.com.cn/problem/P1495) [P4777 【模板】扩展中国剩余定理(EXCRT)](https://www.luogu.com.cn/problem/P4777) [P3846 【模板】BSGS / [TJOI2007] 可爱的质数](https://www.luogu.com.cn/problem/P3846)## D14[P1450 [HAOI2008] 硬币购物](https://www.luogu.com.cn/problem/P1450) 先当完全背包跑一遍dp,然后直接容斥就行了。
[P6076 [JSOI2015] 染色问题](https://www.luogu.com.cn/problem/P6076)## D15
[CF343D Water Tree](https://www.luogu.com.cn/problem/CF343D) 操作1只会对v的子树有影响,操作2只会对子树中含v的有影响。 开两棵线段树,一棵维护差分,一棵是正常值,带一个时间戳,取时间戳最新的状态即可。
[P2824 [HEOI2016/TJOI2016] 排序](https://www.luogu.com.cn/problem/P2824) 考虑二分第q位的值,将>=x的值都设为1,其他的设为0,然后线段树跑一遍操作,若第q位为一,尝试更打,否则尝试更小,单次check复杂度 $O(n \log n)$,总复杂度 $O(n \log^2 n)$
[P3567 [POI 2014] KUR-Couriers](https://www.luogu.com.cn/problem/P3567) 开一棵主席树,二分即可。
[P1712 [NOI2016] 区间](https://www.luogu.com.cn/problem/P1712) 考虑双指针维护长度在[l,r]之间的线段的最大覆盖次数,开一棵线段树维护区间加和全局max即可,时间复杂度 $O(n \log n)$