
费用流
DeathWH
这个作者很懒,什么都没留下…
展开
-
[TOJ 1636] Going Home
只需要在每个m和H之间进行连边,边权为曼哈顿距离。 然和可以采用二分图最大权匹配或者是费用流。#include#include#include#include#include#includeusing namespace std;const int MAX=310;const int INF=1010101010;struct mcmf{ struct Edge原创 2015-07-15 10:03:45 · 402 阅读 · 0 评论 -
费用流 模板
void addedge(int u,int v,int c,int w){ e[cnt].v=v; e[cnt].c=c; e[cnt].w=w; e[cnt].next=head[u]; head[u]=cnt++; e[cnt].v=u; e[cnt].c=0; e[cnt].w=-w; e[cnt].next=hea原创 2015-08-18 20:06:05 · 355 阅读 · 0 评论 -
[TOJ 2663] Concert Hall Scheduling
You are appointed director of a famous concert hall, to save it from bankruptcy. The hall is very popular, and receives many requests to use its two fine rooms, but unfortunately the previous director原创 2015-08-18 19:46:52 · 407 阅读 · 0 评论 -
UVALive 6129 Sofa, So Good
注意题意为先满足第一种操作总花费时间最小,在进行第二次操作并满足总时间最小。 两次二分图最大全匹配,第一次从工人到沙发连边,权值为第一次操作花费时间,第二次从沙发到工人连边,权值为工人开始工作的时间加上第二次操作的时间。 本人采用费用流写法,最后从残余网络找到答案。#include#include#include#include#includeusing namespace std;原创 2015-08-18 19:59:58 · 579 阅读 · 0 评论