8526: Boss

内存限制:256 MB 时间限制:1 S 标准输入输出
题目类型:传统 评测方式:文本比较 上传者:
提交:1 通过:1

题目描述

NIO is a big boss. He will now dispatch his N employees to K cities. And he must send exactly ei employees to the i-th city. 

NIO has no redundant employees which means,


The cost of sending the i-th employee to the j-th city is ci,j. NIO wants to know the minimum cost of the dispatch.

输入格式

The first line contains two integers N(1≤N≤105) and K(1≤K≤10) --- the number of employees and the number of the cities.
The second line contains K integers ei(1≤ei≤n) --- the number of employees for i-th city.
The following N lines each contain K integers cij(0≤ci,j≤105) --- the cost of sending the i-th employee to the j-th city.

输出格式

One integer represent the minimum cost.

输入样例 复制

5 2
1 4
1 1 
4 3 
4 5 
2 1 
3 2

输出样例 复制

11

分类标签