HDU Problem - 4292 Food(最大流, 建边)
題目鏈接
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. �阤 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. �阤 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 NNYSample Output
3AC
- 建邊
- 源點(diǎn)到食物,權(quán)值為數(shù)量
- 食物到人,權(quán)值為inf
- 人到(拆點(diǎn)人),權(quán)值為1(保證不會(huì)浪費(fèi),同一個(gè)人得到多個(gè))
- 拆點(diǎn)人到飲料,權(quán)值為inf
- 飲料到匯點(diǎn),權(quán)值為數(shù)量
總結(jié)
以上是生活随笔為你收集整理的HDU Problem - 4292 Food(最大流, 建边)的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: HDU Problem - 4280 I
- 下一篇: 费用流:spfa Dijkstra