![]() | ||||
Online Judge | Problem Set | Authors | Online Contests | User |
---|---|---|---|---|
Web Board Home Page F.A.Qs Announcement | Current Contest Past Contests Scheduled Contests Award Contest |
Minimum Cost Time Limit:4000MS Memory Limit:65536K
Dearboy, a goods victualer, now comes to a big problem, and he needs
your help. In his sale area there are N shopkeepers (marked from 1 to
N) which stocks goods from him.Dearboy has M supply places (marked from
1 to M), each provides K different kinds of goods (marked from 1 to K).
Once shopkeepers order goods, Dearboy should arrange which supply place
provide how much amount of goods to shopkeepers to cut down the total
cost of transport.
The input consists of multiple test cases. The first line of each test
case contains three integers N, M, K (0 < N, M, K < 50), which
are described above. The next N lines give the shopkeepers' orders,
with each line containing K integers (there integers are belong to [0,
3]), which represents the amount of goods each shopkeeper needs. The
next M lines give the supply places' storage, with each line containing
K integers (there integers are also belong to [0, 3]), which represents
the amount of goods stored in that supply place.
For each test case, if Dearboy can satisfy all the needs of all the shopkeepers, print in one line an integer, which is the minimum cost; otherwise just output "-1". Sample Input
POJ Monthly--2005.07.31, Wang Yijie |
[Submit] [Go Back] [Status] [Discuss]
All Copyright Reserved 2003-2005 Ying Fuchen,Xu Pengcheng
Any problem, Please Contact Administrator