![](https://img-blog.csdnimg.cn/20201014180756930.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
网络流
h_lizeming
这个作者很懒,什么都没留下…
展开
-
Escape HDU - 3605(最大流)
M - Escape2012 If this is the end of the world how to do? I do not know how. But now scientists have found that some stars, who can live, but some people do not fit to live some of the planet. Now s...原创 2018-08-09 08:36:58 · 140 阅读 · 0 评论 -
HDU4292 Food(结点容量模型+多源多汇模型)
题目链接http://poj.org/problem?id=3281题目Cows are such finicky eaters. Each cow has a preference for certain foods and drinks, and she will consume no others.Farmer John has cooked fabulous meals f...原创 2018-08-06 09:52:10 · 198 阅读 · 0 评论 -
POJ2195 Going Home (费用流SPFA版 || 二分图最大权匹配)
题目链接http://poj.org/problem?id=2195题意给定n个人和n个房子,每个房子只能住一个人(但可以停留若干人)。 给定一个N*M的矩阵,‘H’表示房子,’m‘表示人,’.’表示空地。每个人可以往上、下、左、右四个方向走,走一步的费用是1.求每个人都找到一个房子住下的最少花费。分析一个人匹配一个房子,联系到二分图最大权匹配。权值为人到房子的花费,即曼哈顿...原创 2018-08-06 10:18:22 · 208 阅读 · 0 评论 -
I - Control HDU - 4289
这种题目如果顶点或者边的数目开得少的话就会显示T,所以注意一下就好#include <iostream>#include <cstdio>#include <cstring>#include <queue>#include <map>#include <vector>#include <strin...原创 2018-08-06 10:26:17 · 186 阅读 · 0 评论 -
H - Food HDU - 4292
题目链接http://acm.hdu.edu.cn/showproblem.php?pid=4292读题给定N个人、F种食物、M种饮料以及每种食物数量、每种饮料数量。 通过一个N*F的矩阵给出某个人是否接受某种食物。 再通过一个N*M矩阵给出某个人是否接受某种饮料。 顾客的要求是同时有饮料和食物(即其接受的饮料至少提供一瓶,接受的食物至少提供一份)。 求最多能满足多少位顾客。...原创 2018-08-06 10:24:05 · 154 阅读 · 0 评论 -
G - Island Transport
读题给定一个无向图,求从最左侧的点到最右侧的点的最大流。解题无向图的最大流与有向图的最大流的区别在于反向边的流量不是零而是与正向边相等。注意这点之后,再打一个Dinic算法模板。考虑到数据特别地大,需要进行当前弧优化。即在每一次找增广路前进行:while(bfs()) { for(int i=1;i<=N;i++) cur[i...原创 2018-08-09 08:56:57 · 245 阅读 · 0 评论 -
E - Minimum Cost(费用流)
题意:有N个供应商,M个店主,K种物品。每个供应商对每种物品的的供应量已知,每个店主对每种物品的需求量的已知,从不同的供应商运送不同的货物到不同的店主手上需要不同的花费,又已知从供应商Mj送第kind种货物的单位数量到店主Ni手上所需的单位花费。问:供应是否满足需求?如果满足,最小运费是多少?解决方法是用费用流。个人觉得网络流都是比较暴力的算法,就是两个收索结合,都是比较暴力的。...原创 2018-08-09 08:52:25 · 350 阅读 · 0 评论 -
F - Power Network POJ - 1459
#include <stdio.h> #include <string.h> #include <queue> using namespace std; const int N = 105; const int inf = 0x3f3f3f3f; int g[N][N]; int flow[N][N]; int p[N]; ...原创 2018-08-09 08:45:44 · 149 阅读 · 0 评论 -
G - Island Transport (最大流模板题)
In the vast waters far far away, there are many islands. People are living on the islands, and all the transport among the islands relies on the ships. You have a transportation company there. Some...原创 2018-08-09 08:44:36 · 318 阅读 · 0 评论 -
A - ACM计算机工厂 POJ - 3436
就是EK建图#include<stdio.h>#include<iostream>#include<string.h>#include<algorithm>#include<queue>using namespace std;const int MAXN=110;const int INF=0x3fffffff;in...原创 2018-08-06 09:39:13 · 170 阅读 · 0 评论