Given n number of cashiers exchanging the money. At the moment, cashier had number of people in front of him. The person in the line to cashier had notes.
Find, how much early can one exchange his notes.
Time taken by the cashiers:
- The cashier took 5 seconds to scan a single note.
- After the cashier scanned every note for the customer, he took 15 seconds to exchange the notes.
Input : n = 5
k = 10 10 10 10 10
m1 = 6 7 8 6 8 5 9 8 10 5
m2 = 9 6 9 8 7 8 8 10 8 5
m3 = 8 7 7 8 7 5 6 8 9 5
m4 = 6 5 10 5 5 10 7 8 5 5
m5 = 10 9 8 7 6 9 7 9 6 5
Output : 480
Explanation: The cashier takes 5 secs for every note of each customer, therefore add 5*m[i][j]. Each cashier spends 15 seconds for every customer, therefore add 15*k to the answer. The minimum time obtained after calculating the time taken by each cashier is our answer. Cashier m4 takes the minimum time i.e. 480.
Input : n = 1
k = 1
m1 = 100
Output : 515
Approach : Calculate the total time for every cashier and minimum time obtained among all the cashier’s time is the desired answer.
Below is the implementation of above approach:
- Range Minimum Query (Square Root Decomposition and Sparse Table)
- Quick ways to check for Prime and find next Prime in Java
- Minimum number of increment/decrement operations such that array contains all elements from 1 to N
- How to overcome Time Limit Exceed(TLE)?
- What to do at the time of Wrong Answer (WA)?
- Sqrt (or Square Root) Decomposition | Set 2 (LCA of Tree in O(sqrt(height)) time)
- Find two numbers from their sum and XOR
- Represent a number as sum of minimum possible psuedobinary numbers
- Minimum difference between groups of size two
- Find if it is possible to reach the end through given transitions
- Find the arrangement of queue at given time
- Find the position of the last removed element from the array
- Find if neat arrangement of cups and shelves can be made
- Minimum total cost incurred to reach the last station
- Find k numbers which are powers of 2 and have sum N | Set 1
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.
Improved By : vt_m