摘要: 读入以后想枚举j,用个maxv[i][j]数组表示在第i行,从第j个开始n个的最大值。 后来再枚举i,记录最大值。 最小值同理。 复杂度O(abn)。 #include #include #include using namespace std; const int maxn = 1000; const int INF = 0x3f3f3f3f; int n,m,k,ans = ... 阅读全文
posted @ 2016-04-11 21:47 invoid 阅读(148) 评论(0) 推荐(0) 编辑
摘要: 二分分值最大值lid,把所有的分值小于lid的边加入,如果图联通,证明可以。 #include #include #include using namespace std; const int maxn = 100000 + 10; const int maxm = 200000 + 10; int h[maxn],p = -1; int n,m,l,r,lid; int v[maxm]... 阅读全文
posted @ 2016-04-11 21:14 invoid 阅读(172) 评论(0) 推荐(0) 编辑
摘要: 这道题分为俩步,第一是求最大流,第二是在第一问的残量网络上求最小费用流。 建图时俩个点直接连2条边,一条容量为f[i],费用为0,另一条容量为inf,费用为c[i].这样就可以跑俩个算法了 第二问设一个虚拟源点S与1连容量为k,费用为0的边,n与一个虚拟汇点T连容量为k,费用为0的边。这样一直跑,最 阅读全文
posted @ 2016-04-11 21:07 invoid 阅读(189) 评论(0) 推荐(0) 编辑