LOPOV - Lopov

题意翻译

## 【题目描述】 国家经济形势艰难,政府的农业补贴资金减少,Mirko不得不再次转行,这次他的职业是——小偷。 他的第一票是打劫一家珠宝店。 这家珠宝店有$N$件首饰,每件首饰都有它的质量$M[i]$和价值$V[i]$。Mirko有$K$个袋子来存放他的战利品。每个袋子可以容纳的最大质量是$C[i]$。他计划将所有的战利品存放在这些袋子中,为了防止逃跑时首饰之间互相磨损,每个袋子只放一件首饰。 请你计算出Mirko可以偷到的最大珠宝价值。 ## 【输入格式】 第1行输入包含两个整数$N$和$K$。 以下N行中的每一行包含一对数字$M[i]$和$V[i]$。以下K行中的每一行包含数字$C[i]$。 ## 【输出格式】 输出共一行一个整数,即最大的珠宝总价值。 ## 【输入样例1】 ``` 2 1 5 10 10 0 100 11 ``` ## 【输出样例1】 ``` 10 ``` ## 【输入样例2】 ``` 3 2 1 65 5 23 2 99 10 2 ``` ## 【输出样例2】 ``` 164 ``` ## 【样例2说明】 Mirko将第一件首饰放入第二个包,第三件放入第一个包。 ## 【数据规模】 对于15%的数据:$1\le N,K\le 1,000$; 对于25%的数据:$1\le N,K\le 50,000$; 对于100%的数据:$1\le N,K\le 300,000$;$0\le M[i],V[i]\le 1,000,000$;$1\le C[i]\le 100,000,000$;

题目描述

The difficult economic situation in the country and reductions in government agricultural subsidy

输入输出格式

输入格式


The first line of input contains two numbers, N and K (1 Each of the following N lines contains a pair of numbers, Mi and Vi (1 Each of the following K lines contains a number, Ci (1 All numbers in the input are positive integers.

输出格式


The first and only line of output must contain the maximum possible total jewellery value.

输入输出样例

输入样例 #1

2 1 
5 10 
100 100 
11

输出样例 #1

10