ProblemCode: NITcourier
NITCourier is a very famous and well established company in the market and well known for transporting products with minimum cost for their customers. Your friend chandu works at CourierRank and is facing a problem these days. You being an excellent programmer and his friend. He asks you to help him with the problem. Problem requires to deliver N couriers(Assume each courier to be identical) to N locations in the city with two kinds of delivery options: Option 1 - A Big Truck: It can carry any number of boxes to any location in the city for cost L dollars. Option 2 - A Small Car: It costs R dollars for delivering 1 box to a location 1 unit away.
For the sake of simplicity, Let us assume that: 1) The whole city is located on a single straight road. 2) The distance between consecutive cities is 1 unit. 3) All the couriers are placed exactly 1 unit distance before the first location.
Help your friend chandu, Finding the minimum cost for delivering the couriers.
Input: First line of input contains three integers N,L,R seperated by space, Where N is the number of Boxes, L and R are as described above. Second line of input contains N integers seperated by space which are the locations where ith box needs to be couriered.
Output: Output contains a single integer, which the minimum possible cost(in dollars) for delivering all the boxes to their respective locations.
Constraints: 1<=N<=100 1<=L,R<=100000. 1<=location of box <= 10^6
Out of many one optimal way to courier all the boxes in 600 dollars is: Use Truck for Box 1 to deliver to location 1000 : costs 200 dollars Use Truck for Box 2 and Box 3 to deliver to location 40: costs 200 dollars Use Car to move Box 2 to level 50 : costs 100 dollars Use car to move Box 4 to level 10 : costs 100 dollars Total: 600 Dollars.