摘要: 参考博客: https://www.luogu.com.cn/blog/Mogician/Network-Flow-Guide 可以先了解了解johnson全源最短路算法。 核心思想为给每个点一个顶标,改边权为$h[x]+w-h[y]$。 如果顶标设的好(设为最短路),就可以保证边权非负,然后跑di 阅读全文
posted @ 2020-08-08 21:28 Cold_Chair 阅读(520) 评论(0) 推荐(0)
摘要: 参考cz_xuyixuan的营员交流。 #include<bits/stdc++.h> #define fo(i, x, y) for(int i = x, _b = y; i <= _b; i ++) #define ff(i, x, y) for(int i = x, _b = y; i < _ 阅读全文
posted @ 2020-08-08 20:03 Cold_Chair 阅读(315) 评论(2) 推荐(0)
摘要: https://gmoj.net/senior/#main/show/5067 题解: 考虑$[l,r]∩[x,y] \ne ∅$的充要条件是$max(l,x)\le min(r,y)$ 即$l \le y且 x \le r$ 那么每次相当于修改矩形内的点。 套上一个K-D tree,问题变成了: 阅读全文
posted @ 2020-08-08 11:30 Cold_Chair 阅读(321) 评论(0) 推荐(0)