POJ3281 Dining
来源:互联网 发布:中国海关统计数据库 编辑:程序博客网 时间:2024/04/30 14:48
Description
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 for his cows, but he forgot to check his menu against their preferences. Although he might not be able to stuff everybody, he wants to give a complete meal of both food and drink to as many cows as possible.
Farmer John has cooked F (1 ≤ F ≤ 100) types of foods and prepared D (1 ≤ D ≤ 100) types of drinks. Each of his N (1 ≤ N ≤ 100) cows has decided whether she is willing to eat a particular food or drink a particular drink. Farmer John must assign a food type and a drink type to each cow to maximize the number of cows who get both.
Each dish or drink can only be consumed by one cow (i.e., once food type 2 is assigned to a cow, no other cow can be assigned food type 2).
Input
Lines 2..N+1: Each line i starts with a two integers Fi and Di, the number of dishes that cow i likes and the number of drinks that cow i likes. The next Fi integers denote the dishes that cow i will eat, and the Di integers following that denote the drinks that cow i will drink.
Output
Sample Input
4 3 32 2 1 2 3 12 2 2 3 1 22 2 1 3 1 22 1 1 3 3
Sample Output
3
Hint
Cow 1: no meal
Cow 2: Food #2, Drink #2
Cow 3: Food #1, Drink #1
Cow 4: Food #3, Drink #3
The pigeon-hole principle tells us we can do no better since there are only three kinds of food or drink. Other test data sets are more challenging, of course.
- poj3281 - Dining
- POJ3281--Dining
- poj3281 Dining
- poj3281 Dining
- POJ3281-Dining
- POJ3281 Dining
- POJ3281 Dining
- poj3281 Dining
- POJ3281:Dining
- 【POJ3281 Dining 】最大流
- POJ3281 Dining (SAP+GAP)
- 【poj3281】【最大流】Dining
- POJ3281 网络流 dining
- poj3281 Dining Dinic
- 【POJ3281】Dining 网络流
- POJ3281 Dining(最大流)
- 【poj3281】Dining 最大流
- POJ3281 Dining 最大流
- 从今天开始,拼命把自己锻炼成一个软件人才,立此博以铭志
- Objective-C MVC MVVM MVP
- java工具,框架等的历史版本下载页面
- js中的正则表达式入门
- java NIO基础知识
- POJ3281 Dining
- matlab更改colorbar字体的大小,设置范围
- 团体程序设计天梯赛-练习集-L3-007. 天梯地图(最短路)
- github + jenkins 如何不使用验证达到触发的目的
- get_scan_count
- CAMShift_OpenCV_Python
- 内核中的锁机制
- dubbo原理解析
- Kafka 0.10 KafkaConsumer流程简述