All submissions for this problem are available.
Grofers has large warehouses where each warehouse is managed by a single robot named GoJwala.
GoJwala's job is to receive the order and pickup the corresponding order item from the
warehouse shelf and drop the item into a delivery box.
Each warehouse recieves N orders daily. Each order is defined by the following:
1) Unique order Id
2) Order received time
3) Number of items recieved in this order.
4) Deadline to pack this order.
5) Loss incurred by Grofers in case the above deadline is not met.
GoJwala needs to pickup and place these items in the delivery box before the deadline for this order is reached. In case GoJwala cannot pack the order within the deadline, Grofers incurs a loss per item in that order. You need to program GoJwala to pack each item in the order before the deadline is reached minimizing the loss incurred by Grofers. The program should provide the minimum amount of loss incurred by Grofers.
Please note that GoJwala can pick up at most one item from the warehouse shelf at a unit time and this pickup and drop takes exactly one unit time. GoJwala can start next job as soon as the first item is dropped. As a result, you can ignore the time it takes the robot to go from drop to pickup location in the warehouse. The robot can pickup at the items at any time between the order received time (inclusive) and the before the delivery time (not inclusive). GoJwala cannot pick any items from a order exactly at its deadline time.
InputInput: T- Number of Test Cases N - Number of orders
For each order, we have the following order characteristics:
1) orderId: Unique order identifier - an integer
2) receiveTime: An integer denoting a unit in time
3) numItems: Number of items in this order - an integer
4) packingDeadline: Deadline to pack this order - an integer
5) loss: Loss incurred if this order is not packed within a particular time frame - an integer
Note: The input will guarantee to have receiveTime + numItems <= packingDeadline
outputThe output contain the minimum amount of loss incurred by Grofers.
1 1 5 6 10
2 1 5 6 10
ExplanationThere is only one test case. and Gojwala has only two orders with orderids 1 and 2 , recievetime of orderid 1 is 1, number of item in this order is 5 and packing deadline is 6 so all Item of this order can be packed in the delivery box = 1x5 = 5 unit time recieve time =1 total time 1+5 =6. All the time Gojwala waisted on order id 1 so GoJwala is not able to packed a single item of order id 2, hence forth the loss on second order is 10x5 =50 so total loss =50
|Time Limit:||1 - 2 sec|
|Source Limit:||50000 Bytes|
|Languages:||C, CPP14, JAVA, PYTH, PYTH 3.6, PYPY, CS2, PAS fpc, PAS gpc, RUBY, PHP, GO, NODEJS, HASK, SCALA, D, PERL, FORT, WSPC, ADA, CAML, ICK, BF, ASM, CLPS, PRLG, ICON, SCM qobi, PIKE, ST, NICE, LUA, BASH, NEM, LISP sbcl, LISP clisp, SCM guile, JS, ERL, TCL, PERL6, TEXT, SCM chicken, CLOJ, FS|
Fetching successful submissions
If you are still having problems, see a sample solution here.