上一页 1 ··· 7 8 9 10 11 12 13 14 15 下一页
摘要: 无向图费用流还有一段话摘自别人博客这道题是无向图的最小费用最大流问题,看清楚是无向图的。这么说无向图和有向图的费用流问题有什么区别呢?主要是反向边的问题。首先我们说一下最大流问题中的反向边,我们需要将其cap[u][v]=0表示容量为0,而在费用流问题中添加了费用,所以肯定不能像之前那么简单处理了,... 阅读全文
posted @ 2014-10-13 20:05 Commence 阅读(347) 评论(0) 推荐(0)
摘要: 最小费用最大流 源点->警察->bank->汇点剩下的模板就可以#include #include #include #include #include #include #include #include #include #include #include #include #include #... 阅读全文
posted @ 2014-10-13 13:25 Commence 阅读(256) 评论(0) 推荐(0)
摘要: 最大流解决 。设置源点 0,连接所有设备(device) 。设备-插头 -汇点#include #include #include #include #include #include #include #include #include #include #include #include #in... 阅读全文
posted @ 2014-10-12 15:41 Commence 阅读(215) 评论(0) 推荐(0)
摘要: 一开始就想到网络流。。后来一想暴力能不能过。自己写的T了。看了别人有暴力过的。暴力的思路就是6进制数字表示给予的衣服的数量。然后每个人的需求表示成01 的6位串然后爆搜。网络流就建一个源一个汇 然后针对输入 i - i + 6 边权为N/6; 然后M个人由衣服连M个人边权为1。与源直接相连的点就IN... 阅读全文
posted @ 2014-10-12 11:50 Commence 阅读(301) 评论(0) 推荐(0)
摘要: 直接暴力模拟 。以每次还未被删除的cnt[i]为一周期进行暴力模拟#include #include #include #include #include #include #include #include #include #include #include #include #include ... 阅读全文
posted @ 2014-10-11 23:51 Commence 阅读(281) 评论(0) 推荐(0)
摘要: 费用流第一题主要是临街表实现这个算法的问题。这里存下思路还是比较简单。源点0,汇点N+1.费用为边长。容量为1.(普通边)。添加边为2(0-1 N-N+1)代码#include #include #include #include #include #include #include #includ... 阅读全文
posted @ 2014-10-11 18:29 Commence 阅读(208) 评论(0) 推荐(0)
摘要: 题意:懒得打了。LUCKY CAT 里有http://163.32.78.26/homework/q10330.htm第一个网络流题目。每个节点都有一个容量值。需要拆点。拆成i - > i + N 边权为容量值另外注意B个点 连接方式:s - 集合BD个点 链接方式 集合D + N -> t汇点其他... 阅读全文
posted @ 2014-10-10 13:20 Commence 阅读(306) 评论(0) 推荐(0)
摘要: 纠结在这句话了If it is impossible to get from some town to some other town, print "Send Kurdy" instead. Put an empty line after each test case.题目要求是如果一旦存在一个点... 阅读全文
posted @ 2014-10-09 18:14 Commence 阅读(201) 评论(0) 推荐(0)
摘要: 题意 给出方向(有向)然后判断从一个点到另一个点的方案数。如果有无数条那么对应位置置为-1直接先dp处理出来。dp[i][j] = sum(dp[i][k]*dp[k][j]) 同时如果两点之间有无限条路径。那么这两点之间必然有一环存在。有f[k][k]!=0#include #include #i... 阅读全文
posted @ 2014-10-09 15:36 Commence 阅读(193) 评论(0) 推荐(0)
摘要: 动态规划类似FLOYD dp[i][j][k] 表示第i个点经过K次到达j点能获得的最大利润#include #include #include #include #include #include #include #include #include #include #include #incl... 阅读全文
posted @ 2014-10-09 10:12 Commence 阅读(210) 评论(0) 推荐(0)
上一页 1 ··· 7 8 9 10 11 12 13 14 15 下一页