ACM: 图论题 poj 1149 网络流问题
来源:互联网 发布:java酒店管理系统程序 编辑:程序博客网 时间:2024/05/17 19:14
Description
All data concerning customers planning to visit the farm on thatparticular day are available to Mirko early in the morning so thathe can make a sales-plan in order to maximize the number of pigssold.
More precisely, the procedure is as following: the customerarrives, opens all pig-houses to which he has the key, Mirko sellsa certain number of pigs from all the unlocked pig-houses to him,and, if Mirko wants, he can redistribute the remaining pigs acrossthe unlocked pig-houses.
An unlimited number of pigs can be placed in every pig-house.
Write a program that will find the maximum number of pigs that hecan sell on that day.
Input
The next line contains M integeres, for each pig-house initialnumber of pigs. The number of pigs in each pig-house is greater orequal to 0 and less or equal to 1000.
The next N lines contains records about the customers in thefollowing form ( record about the i-th customer is written in the(i+2)-th line):
A K1 K2 ... KA B It means that this customer has key to thepig-houses marked with the numbers K1, K2, ..., KA (sortednondecreasingly ) and that he wants to buy B pigs. Numbers A and Bcan be equal to 0.
Output
Sample Input
3 3
3 1 10
2 1 2 2
2 1 3 3
1 2 6
Sample Output
7
题意: Mirko有m个猪屋, 有n个客人要想他买猪, 每位客人会要其中A个猪屋内的共B只猪, Mirko
解题思路:
代码:
#include <cstdio>
#include <iostream>
#include <cstring>
#include <queue>
using namespace std;
#define MAX 1105
#define MAXSIZE 115
const int INF = (1<<29);
int n, m;
int cap[MAXSIZE][MAXSIZE], num[MAX], flow[MAXSIZE][MAXSIZE];
int a[MAXSIZE], p[MAXSIZE];
int start, end;
int first[MAX];
inline int min(int a, int b)
{
}
void readGraph()
{
}
int KM()
{
}
int main()
{
//
}
- ACM: 图论题 poj 1149 网络流问题
- ACM: 最大流问题 图论题 poj 2263
- ACM: 图论题 poj 3308 最大流问题
- ACM: 图论题 poj 2240 (floyd + ST…
- ACM: 图论题 poj 1135
- ACM: 图论题 poj 3…
- ACM: 图论题 poj 1…
- ACM: 图论题 poj 1…
- ACM: 最小费用最大流 图论题 poj 2…
- ACM: 最大流 图论题 poj 1797
- ACM: 二分法 数论题 poj 1905
- ACM: 匈牙利算法 图论题 poj 3041 …
- ACM: 差分约束 图论题 poj 2983 sp…
- ACM: 有向欧拉图 图论题 poj 1386 …
- ACM: 图论题 poj 3177 同 3352
- ACM: 网络流 图论 poj 1459
- ACM: 二进制问题 数论题 poj 1023
- ACM: 最小费用用最大流 图论题 poj…
- Android的自定义控件起步
- dos批处理中%~dp0%的说明
- ACM: 图论题 poj 3308 最大流问题
- ACM: 搜索题 poj 1020
- ACM: 图论题 poj 1201 差分约束
- ACM: 图论题 poj 1149 网络流问题
- ACM: 图论题 poj 1236 强连通
- ACM: 图论题 poj 1275 差分约束题
- 图论: 差分约束系统
- ACM: 图论题 poj 1…
- ACM: 图论题 poj 1466 最大独立团
- ACM: 图论题 poj 1…
- ACM: 动态规划题 sicily…
- ACM: 动态规划题 《黑书…