poj1149】的更多相关文章

想了好久啊...(#-.-) 开始想到m*n个点的构图,明显超时,于是考虑压缩节点个数 我们发现每个猪圈最后被有且只有一个人调整,于是想到对于一个人,连接他能调整的每个猪圈的上一个控制人.(不懂可以开代码  (・(ェ)・)   ) /** * Problem:POJ1149 * Author:Shun Yao * Time:2013.9.13 * Result: * Memo: */ #include <cstring> #include <cstdio> #define INF…
题目链接: https://vjudge.net/problem/POJ-1149 题目大意: M个猪圈,N个顾客,每个顾客有一些的猪圈的钥匙,只能购买这些有钥匙的猪圈里的猪,而且要买一定数量的猪,每个猪圈有已知数量的猪,但是猪圈可以重新打开,将猪的个数,重新分配,以达到卖出的猪的数量最多. 思路: 难点在于如何构造容量网络 (1)将顾客看做出源点和汇点之外的结点,另外增加源点s和汇点t (2)源点和每个猪圈的第一个用户连边,边权是猪圈中猪的数目 (3)若有重边,将权合并 (4)顾客j紧跟在顾客…
[BZOJ1280][POJ1149]Emmy卖猪pigs 试题描述 Emmy在一个养猪场工作.这个养猪场有 \(M\) 个锁着的猪圈,但Emmy并没有钥匙.顾客会到养猪场来买猪,一个接着一个.每一位顾客都会有一些猪圈的钥匙,他们会将这些猪圈打开并买走固定数目的猪. 所有顾客有的钥匙和他们需要买猪的数量在事先都告诉了Emmy,于是Emmy要订一个计划,使得卖出去的猪最多. 买卖的过程是这样的:一个顾客前来,并打开所有他可以打开的猪圈.然后Emmy从这些猪圈里牵出固定数目的猪卖给顾客(最多只能和顾…
题目链接:http://poj.org/problem?id=1149 PIGS Time Limit: 1000MS   Memory Limit: 10000K Total Submissions:24094   Accepted: 10982 Description Mirko works on a pig farm that consists of M locked pig-houses and Mirko can't unlock any pighouse because he doe…
PIGS Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 20662   Accepted: 9435 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…
                                                                         PIGS Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 20146   Accepted: 9218 Description Mirko works on a pig farm that consists of M locked pig-houses and Mirko can…
非常好的网络流 每个顾客分别用一个结点来表示. 对于每个猪圈的第一个顾客,从源点向他连一条边,容量就是该猪圈里的猪的初始数量 对于每个猪圈,假设有n个顾客打开过它,则对所有整数i∈[1, n),从该猪圈的第i个顾客向第i + 1个顾客连一条边,容量为无穷. 从各个顾客到汇点各有一条边,容量是各个顾客能买的数量上限. 其实很好理解 ; type node=record        from,point,flow,next:longint;      end; ..] of longint;  …
PIGS Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 16555   Accepted: 7416 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 个猪圈(M ≤ 1000),每个猪圈里初始时有若干头猪.⦁ 一开始所有猪圈都是关闭的.⦁ 依次来了 N 个顾客(N ≤ 100),每个顾客分别会打开指定的几个猪圈,从中买若干头猪.⦁ 每个顾客分别都有他能够买的数量的上限.⦁ 每个顾客走后,他打开的那些猪圈中的猪,都可以被任意地调换到其它开着的猪圈里,然后所有猪圈重新关上.    问总共最多能卖出多少头猪. 举个例子来说.有 3 个猪圈,初始时分别有 3. 1 和 10 头猪.依次来了 3 个顾客,…
PIGS Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 21678   Accepted: 9911 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…