平面图上 $s$ 到 $t$ 的最大流,等于把 $t$ 连向 $s$ 之后,对偶图上 $(t,s)$ 对应的边两端点的最短路(求最短路时忽略边 $(s,t)$)。假设我们把原图的每个端点向外连一条射线,把无穷的区域分成 $n$ 个部分,则对偶之后的图是一棵有 $n$ 个叶子的树。而原图中的割对应着把叶子分成两个区间后,两个区间之间的最短路。容易发现,我们可以以两两叶子之间的距离作为边权来求最小生成树,则只有最小生成树上的边有用(其实这就是 Gomory-Hu 树的对偶)。之后枚举树上的边算贡献即可。时间复杂度 $O(n\log n)$。
QOJ.ac
QOJ
As we are currently experiencing an overwhelming number of web requests for fetching user submissions, we have temporarily disabled the full submissions list. You must now be logged in to view submissions.
Discussion #221 for Problem #5048. All Pair Maximum Flow
Type: Editorial
Status: Open
Posted by: jiangly
Posted at: 2025-12-13 00:17:07
Last updated: 2025-12-13 00:17:11
题解
Comments
No comments yet.