博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
HDU 4292 Food
阅读量:6334 次
发布时间:2019-06-22

本文共 2869 字,大约阅读时间需要 9 分钟。

Food

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)

Total Submission(s): 2136    Accepted Submission(s): 745

Problem Description
  You, a part-time dining service worker in your college’s dining hall, are now confused with a new problem: serve as many people as possible.
  The issue comes up as people in your college are more and more difficult to serve with meal: They eat only some certain kinds of food and drink, and with requirement unsatisfied, go away directly.
  You have prepared F (1 <= F <= 200) kinds of food and D (1 <= D <= 200) kinds of drink. Each kind of food or drink has certain amount, that is, how many people could this food or drink serve. Besides, You know there’re N (1 <= N <= 200) people and you too can tell people’s personal preference for food and drink.
  Back to your goal: to serve as many people as possible. So you must decide a plan where some people are served while requirements of the rest of them are unmet. You should notice that, when one’s requirement is unmet, he/she would just go away, refusing any service.
 

Input
  There are several test cases.
  For each test case, the first line contains three numbers: N,F,D, denoting the number of people, food, and drink.
  The second line contains F integers, the ith number of which denotes amount of representative food.
  The third line contains D integers, the ith number of which denotes amount of representative drink.
  Following is N line, each consisting of a string of length F. e jth character in the ith one of these lines denotes whether people i would accept food j. “Y” for yes and “N” for no.
  Following is N line, each consisting of a string of length D. e jth character in the ith one of these lines denotes whether people i would accept drink j. “Y” for yes and “N” for no.
  Please process until EOF (End Of File).
 

Output
  For each test case, please print a single line with one integer, the maximum number of people to be satisfied.
 

Sample Input
4 3 3
1 1 1
1 1 1
YYN
NYY
YNY
YNY
YNY
YYN
YYN
NNY
 

Sample Output
3
Source
构图是老生常谈的事情了。
S-->food连边food[i] ;
food-->man1连边1
man1-->man2连边1
mam2-->drink 连边1 ,
diink-->T连边dink[i]
#include 
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#define Max(a,b) ((a)>(b)?(a):(b))#define Min(a,b) ((a)<(b)?(a):(b))using namespace std ;typedef long long LL ;#define MAXN 1000#define inf 2100000000int g[MAXN][MAXN],level[MAXN];int bfs(int n,int s,int t){ int que[1000],head,tail,i; head=tail=0; que[tail++]=s; memset(level,-1,sizeof(level)); level[s]=1; while(head
g[path[i]][path[i+1]]){ low=g[path[i]][path[i+1]]; cut=i; } } maxflow+=low; for(i=0;i

转载于:https://www.cnblogs.com/liyangtianmen/p/3379707.html

你可能感兴趣的文章
MAC下GitHub命令操作
查看>>
springboot之filter/listener/servlet
查看>>
Thinkphp --- 去掉index.php
查看>>
Spring+SpringMVC+MyBatis深入学习及搭建(十一)——SpringMVC架构
查看>>
oracle故障解决
查看>>
tcpdump
查看>>
数据库内存结构
查看>>
利用Shell开发跳板机功能脚本案例
查看>>
51CTO的技术门诊谈OSSIM
查看>>
六年心路成长 —— 做自己
查看>>
Unix整理笔记——高级命令sed和awk——里程碑M10
查看>>
Linux系统详解 第六篇:系统的启动、登录、注销与开关机
查看>>
ios电话拨打进行监听电话状态
查看>>
京东基于Spark的风控系统架构实践和技术细节
查看>>
什么时候使用CountDownLatch
查看>>
C#之MemberwiseClone与Clone
查看>>
Android性能优化之利用Rxlifecycle解决RxJava内存泄漏
查看>>
转: 如何为你的开源项目选择一个合适的开源协议?
查看>>
关系型数据库和NOSQL数据库对比
查看>>
Atitit 记录方法调用参数上下文arguments
查看>>