poj 1149 pigs(最大流)】的更多相关文章

Time Limit: 1000MS Memory Limit: 10000K Description Mirko works on a pig farm that consists of M locked pig-houses and Mirko can't unlock any pighouse because he doesn't have the keys. Customers come to the farm one after another. Each of them has ke…
题意以及分析:http://ycool.com/post/zhhrrm6#rule3 主要是建图,简化图,然后在套最大流的模板. #include <iostream> #include<string.h> #include<cstdio> using namespace std; struct Node { int v,cap,flow,next; Node(){} Node(int _v,int _cap,int _flow,int _next) { v=_v; c…
题目大意:迈克在农场工作,农场有 m 个猪舍,每个猪舍有若干只猪,但是迈克不能打开任何一间猪舍.有 n 个顾客前来购买,每个顾客有最大的购买数量,每个顾客可以购买某些猪舍的猪,且顾客可以打开这些猪舍,从中挑选猪仔.重要的是,迈克可以在打开的这些猪舍中重新分配猪仔.由于知道每个猪舍的猪仔数目和顾客的购买情况,求迈克可以卖出的最大数目的猪仔. 解题思路:将每个顾客看成一个点,加上源点.汇点.将每个猪舍的第一位客人与源点相连,容量为猪舍中猪仔的数目,将每个猪圈的前以为顾客与后一位顾客相连,容量为INF…
原题 题目大意 给你m个猪圈以及每个猪圈里原来有多少头猪,先后给你n个人,每个人能打开一些猪圈并且他们最多想买Ki头猪,在每一个人买完后能将打开的猪圈中的猪顺意分配在这次打开猪圈里,在下一个人来之前 已打开的猪圈被锁上. 解析 以每个买猪的作为点,并建立原点和汇点. 每个猪圈的第一个访客和原点连一条该猪圈中猪数量的边,每个猪圈的访客(除了以第一个)和上一个访问这个猪圈的人连一条inf的边,每个人向汇点连一条最多买的数量的边. #include<cstdio> #include<queue…
PIGS Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 20738   Accepted: 9481 Description Mirko works on a pig farm that consists of M locked pig-houses and Mirko can't unlock any pighouse because he doesn't have the keys. Customers come t…
题目大意:是有M个猪圈,N个顾客,顾客要买猪,神奇的是顾客有一些猪圈的钥匙而主人MIRKO却没有钥匙,多么神奇?顾客可以在打开的猪圈购买任意数量的猪,只要猪圈里有足够数量的猪.而且当顾客打开猪圈后mirko就可以在打开的猪圈之间任意调整猪的数量,(顾客走了之后猪圈要关闭).问mirko怎样做能使顾客买到最多的猪 思路如下:(也是查的,具体原理和原因明天更新) 1.取超级源点和超级汇点: 2.当猪圈被第一次打开时,在源点与当前顾客之间连接一条边,容量为该猪圈的猪的头数: 3.当某个猪圈 不是被第一…
PIGS Time Limit: 1000ms Memory Limit: 10000KB This problem will be judged on PKU. 64-bit integer(整数) IO format: %lld      Java class name: Main   Mirko works on a pig farm that consists of M locked pig-houses and Mirko can't unlock any pighouse becau…
Description Mirko works on a pig farm that consists of M locked pig-houses and Mirko can't unlock any pighouse because he doesn't have the keys. Customers come to the farm one after another. Each of them has keys to some pig-houses and wants to buy a…
PIGS Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 18727   Accepted: 8508 Description Mirko works on a pig farm that consists of M locked pig-houses and Mirko can't unlock any pighouse because he doesn't have the keys. Customers come t…
题目描述:迈克在一个养猪场工作,养猪场里有M 个猪圈,每个猪圈都上了锁.由于迈克没有钥匙,所以他不能打开任何一个猪圈.要买猪的顾客一个接一个来到养猪场,每个顾客有一些猪圈的钥匙,而且他们要买一定数量的猪.某一天,所有要到养猪场买猪的顾客,他们的信息是要提前让迈克知道的.这些信息包括:顾客所拥有的钥匙(详细到有几个猪圈的钥匙.有哪几个猪圈的钥匙).要购买的数量.这样对迈克很有好处,他可以安排销售计划以便卖出的猪的数目最大.更详细的销售过程:当每个顾客到来时,他将那些他拥有钥匙的猪圈全部打开:迈克从…