摘要: 题目链接:https://www.luogu.com.cn/problem/P4015 建立源点s-->0,汇点t-->m+n+1,然后s连向i,流量为a[i],费用为0;j(i+m)连向t,流量为b[j],费用为0。 第一遍建图求最小流量。清空后再重建图,求最大流量(cost全部取反),和prio 阅读全文
posted @ 2020-08-19 20:33 dfydn 阅读(123) 评论(0) 推荐(0) 编辑
摘要: 题目链接:https://www.luogu.com.cn/problem/P3381 用SPFA求费用最短路,用pre记录路径,流量还是原来那样求。 AC代码: 1 #include<cstdio> 2 #include<iostream> 3 #include<cstring> 4 #inclu 阅读全文
posted @ 2020-08-19 19:32 dfydn 阅读(128) 评论(1) 推荐(0) 编辑