题意
做法
结论1:新地址一定都建在旧地址上
然后因为是曼哈顿距离,可以把二维拆成一维来做,以\(x\)这维为例,先将其排序
对于\(i\in[1,m]\),拆\(n+1\)个点出来
\(S\longrightarrow (i,1)(flow:inf),(i,n+1)\longrightarrow T(flow:inf)\),\((i,j)\longrightarrow (i,j+1)(flow:cost)\),\(cost\)为将第\(i\)个地址建在\(j\)时,新与旧之间的花费
\((i,k)\longrightarrow (j,k)(flow:a_{i,j}\times (x_{k}-x_{k-1}))(i<j)\)
这样你会发现第\(i\)个地址建在\(b_i\),第j个地址建在\(b_j\),那么割掉\((i,b_i)-(i,b_i+1),(j,b_j)-(j,b_j+1)\)后,将\(i,j\)间还能通行的边也得割掉,花费恰好满足题意
来源:https://www.cnblogs.com/Grice/p/12658574.html