上一页 1 ··· 11 12 13 14 15 16 17 18 19 ··· 47 下一页

2014年5月7日

摘要: http://acm.hdu.edu.cn/showproblem.php?pid=3667最小费用最大流本题流量和费用不是线性关系,fee=a*flow*flow,所以常规套模板spfa无法得到最小费用观察到每条边流量上限只有5,则可以把一条流量为f的边拆成f条流量为1的边,每条边费用是a*(2*... 阅读全文
posted @ 2014-05-07 21:15 LegendaryAC 阅读(191) 评论(0) 推荐(0) 编辑
 
摘要: http://blog.sina.com.cn/s/blog_64675f540100k2xj.htmlhttp://www.cppblog.com/MatoNo1/archive/2011/07/13/150766.aspx讲解看的这两篇博客,其实最好直接去看国家集训队的论文,别的抄来抄去想找个原... 阅读全文
posted @ 2014-05-07 17:22 LegendaryAC 阅读(146) 评论(0) 推荐(0) 编辑
 
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=30622sat判定性问题模板#include #include #include #include #include #include using namespace std ;struct node { i... 阅读全文
posted @ 2014-05-07 13:55 LegendaryAC 阅读(204) 评论(0) 推荐(1) 编辑
 
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=2292题意:1-n个节点,题目给出了完全二叉树的定义(这个定义似乎有歧义,此题以题目描述为准),且要保持最小堆性质(根节点小于左右子树内的任意元素),问有多少种不同组合解法:dp,dp[n]表示n个元素的合法排列数... 阅读全文
posted @ 2014-05-07 11:53 LegendaryAC 阅读(174) 评论(0) 推荐(0) 编辑

2014年5月1日

摘要: 先用bfs预处理出层次图,然后在层次图上用dfs找增广路径,理论复杂度O(n*n*m)const int INF=0xfffffff ;struct node{ int s,t,cap,nxt ;}e[400005] ;int m,n,cnt,head[100005],level[100005... 阅读全文
posted @ 2014-05-01 13:40 LegendaryAC 阅读(147) 评论(0) 推荐(0) 编辑

2014年4月27日

摘要: http://acm.hdu.edu.cn/showproblem.php?pid=2485n个车站,m条边,两边之间费用为1,问最少摧毁多少车站,使得1-n无法在k时间内到达将2-(n-1)每个点拆成两个,并建立容量为1,费用为0的一条边,源点为1,汇点为2*n-2,这时求最小费用最大流,其中保证... 阅读全文
posted @ 2014-04-27 20:26 LegendaryAC 阅读(269) 评论(0) 推荐(0) 编辑
 
摘要: 每边有一个权值,要求得到最大流并且使得权值和最小把EK算法中的bfs改成spfa,spfa需要注意的是进行松弛的边容量不能为0const int INF=0xfffffff ;struct node{ int s,t,cap,cost,nxt ;}e[200005] ;int sumflow ... 阅读全文
posted @ 2014-04-27 19:32 LegendaryAC 阅读(123) 评论(0) 推荐(0) 编辑

2014年4月26日

摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1533人和房子数量相同,每个人进房子,费用是人到房子的曼哈顿距离,求最小费用可用最小费用最大流求解,建立虚拟的源点和汇点即可#include #include #include #include using nam... 阅读全文
posted @ 2014-04-26 21:37 LegendaryAC 阅读(125) 评论(0) 推荐(0) 编辑

2014年4月16日

摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1402fft做O(nlog(n))大数乘法,kuangbin的模板#include #include #include #include #include using namespace std;const dou... 阅读全文
posted @ 2014-04-16 21:56 LegendaryAC 阅读(180) 评论(0) 推荐(0) 编辑
 
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1498最小顶点覆盖,建立二分图求最大匹配#include #include #include using namespace std ;int M[105][105],k,n,match[505],vis[505]... 阅读全文
posted @ 2014-04-16 21:24 LegendaryAC 阅读(307) 评论(0) 推荐(0) 编辑
上一页 1 ··· 11 12 13 14 15 16 17 18 19 ··· 47 下一页