随笔分类 -  网络流

摘要:区间k覆盖费用流模板题。 离散化后让每个数字最多可用k次即可,源点向起点连边,终点向汇点连边,第i个点向第i+1个点连边,容量都为k,费用为0。 对于给的左闭右开区间,区间左端点向右端点连边,容量为1,费用为-val。 #include <bits/stdc++.h> using namespace 阅读全文
posted @ 2018-09-16 09:32 LMissher 阅读(166) 评论(0) 推荐(0)
摘要:题意:网络流模板题,求1到n的最大流,直接写模板。 代码: #include <cstdio>#include <algorithm>#include <queue>#include <cstring>#define N 30#define INF 1000000using namespace st 阅读全文
posted @ 2017-08-20 09:23 LMissher 阅读(143) 评论(0) 推荐(0)
摘要:题意:网络流的裸题,1为源点,n为汇点,给定每条边的容量,求最大流,用EK算法。 代码: #include <cstdio>#include <queue>#include <algorithm>#include <cstring>#define N 300#define INF 0x7ffffff 阅读全文
posted @ 2017-08-19 16:15 LMissher 阅读(197) 评论(0) 推荐(0)