Лимит времени 2000/4000/4000/4000 мс. Лимит памяти 65000/65000/65000/65000 Кб. Question by Ibrahim Mesecan.
Selling Oranges
Mr. Ilir Dardani produces oranges and export them.
When exporting he puts the oranges into bins (buckets) according
to their sizes. Thus according to their sizes the prices
change.
The size of oranges vary, usually upto 15cms.
They are put into m bins with the sizes b1,
b2, b3..., bm. And it's
known that the bin sizes are in increasing order. An orange fits into bini if its size
is greater than or equal to bini but is less than
bini+1. Mr. Dardani wants to put all
oranges to the biggest bin that they fit.
Question:
Write a program that is going to read bin and
orange information and calculate the total sell price.
Input specification
There are two numbers at the beginning: the number of bins (m)
and the number of oranges (n) where 1 ≤ m ≤ 10 and
1 ≤ n ≤ 50000. The following m lines give the size of
bins followed by price of each orange in that bin,
whe size of bins are between 1 and 15 and price of each orange
is $0.10 and $2.50. The following line gives n positive floating point
numbers between 1 and 15.
Output specification
Show the total sell price.
Sample Input I
3 6
1 0.3
6 0.8
12 1.5
12.4 6.8 14 5 4.7 9
|
Sample Input II
5 10
1 0.3
3 0.5
6 0.8
9 1
12 1.5
5 3 8.2 9.1 6 9 1 10 15 4.6
|
Sample Output I
5.2
|
Sample Output II
7.9
|
Для отправки решений необходимо выполнить вход.
|