#graph802. 运输问题
运输问题
Transportation Problem
Problem Source
Network Flow 24 Problems
Problem Description
Company has warehouses and retail stores. Warehouse holds units of goods; retail store needs units of goods.
Supply and demand are balanced, that is $\sum\limits_{i=1}^{m} a_i = \sum\limits_{j=1}^{n} b_j$.
Shipping one unit of goods from warehouse to retail store costs .
Design a plan that ships all goods from the warehouses to the retail stores, minimizing the total shipping cost.
Input Format
The first line contains two positive integers , the number of warehouses and retail stores.
The next line contains positive integers , the amount of goods in warehouse .
The following line contains positive integers , the amount of goods needed by retail store .
The next lines each contain integers, the cost of shipping one unit from warehouse to retail store .
Output Format
Output two lines: the minimum total shipping cost and the maximum total shipping cost, respectively.
The answer is guaranteed not to exceed .
Sample Input
2 3
220 280
170 120 210
77 39 105
150 186 122
Sample Output
48500
69140