Answered step by step
Verified Expert Solution
Question
1 Approved Answer
please send answer asap Write the python3 code using given sample code . a You have been invited to work in Willy Wonka's chocolate factory.
please send answer asap
Write the python3 code using given sample code . a You have been invited to work in Willy Wonka's chocolate factory. The factory is a magical place where there are infine quarties of chocolate of different types present There are different types of chocolate which are pressed into balls and dropped by a funt. It is given that there are such funnel since each tunnel delivers bals of only one type of chocolate The number of chocolate balls delivered per second is given to you in an array rate. This means that the funnel produces ale chocolate bals per second. ) it is given that there is a container present beneath each funnel which collects all the chocolates being produced by the respective tunnel. Additionally you are given the inventory of chocolates present in each of the N containers already in array available. This means that the amount of chocolate present in the container from the previous days production is available You will swich on all the funnels at once. Your task now is to perform the following operations: . : 1. You will shut down only one funnel at a time. 2. You wil then empty the container beneath the respective fuel You will repeat the above steps to all the containers are emplied. . However, once you have suched off a individual funnel you can no longer restartit. It is given that takes you one second to remove a chocolate ball of any type from the container , it a . Additionally, you are not allowed to emply a container before you switch off the funnel above a You need to find the minimum time required to empty all the containers. Since the answer can be very large return it modulo 10-9-7. Note: . It is mandatory for you to empty the container beneath a fure after shutting it down before you are alowed to switch off any other funnel . It takes zero seconds for you to shut down afunnel. Input Format The first ine contains an integer, N, denoting the number of containers.. Each line of the subsequent lines (where Osi 251 sec. So optimalis 131. 1 def sinTime(rate, available) 2 #write your code here 3 4 5 def main(): 6 7 N = int(input()) 8 rate=[None]*N 9 for j in range(N): 1e rate[j] - int(input()) 11 12 3 available-[None] 'N for j in range(N): available[j] - int(input()) result - mintime(rate, available); print(result) name == "__main__": main() ifStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started