#
WC 5.2 Fill The Bottle

There is a “Fill The Bottle” game in a fun fair where in you have to fill the whole bottle with marbles. Given are the capacity of the bottle, total number(capacity) of marbles, cost of a marble. The size of the marbles are in such a way that all different types of marble can fit in any bottle. Find the minimum cost by filling all the bottles

Note:

1)There always exists a marble with capacity 1 so that a solution always exists.

2.)Any marble can be chosen unlimited number of times.

Format:

The first integer of every line indicates the total elements for an entity.

List of integers denoting capacity of bottles.

List of integers denoting number of marbles.

List of integers denoting cost of marbles.

Testcase 1:

5 2 3 1 5 4

4 3 2 4 1

4 1 2 5 11

Output:21

The first integer of every line indicates the total elements for an entity.

Bottle with capacity 2 will be filled with type 2 marbles i.e 2, sum=2.

Bottle with capacity 3 will be filled with type 1 marble i.e 1, sum=2+1

Bottle with capacity 1 will be filled with type 4 marble i.e 11, sum=2+1+11

Bottle with capacity 5 will be filled with type 1 & type 2 marbles i.e 1&2, sum=2+1+11+1+2

Bottle with capacity 4 will be filled with type 2 marble twice i.e 2*2, sum=2+1+11+1+2+(2*2)=21

Testcase 2:

4 100 200 900 800

4 100 1 798 799

4 3 1 2 15

Testcase 3:

8 15 10 11 12 1 16 20 3

5 1 2 10 3 4

5 11 1 2 4 3

Your final answer should be the multiplication of the outputs of all 3 testcases.

### This challenge is worth 80 points.

### You must be logged in to submit a solution

View ranklist for this challenge

About scoring and submission