Answer to Question #287561 in Python for diyaP

Question #287561

Miss Ural wants to buy colors for Holi, and that too, at the cheapest cost!

There are N shops selling colors near Ural's house, where the i′th shop sells colors at rate of Ri for one unit. Also, i′th shop is located at a distance of Di kilometers from her house. Life was simple, but then petrol and fuel prices soared up. The current price of petrol to travel one kilometer is K

Find the minimum cost at which Miss Ural can buy one unit of color. she does not need to return back home.


  • The first line of input contains T, number of test cases in a file.
  • The next line contains two integers, N and K, as described in the problem statement.
  • The next line contains N space separated integers, denoting Di, i.e. distance of the shop.
  • The next line contains N space separated integers denoting Ri, i.e. rate of the color.


For test case, output minimum cost to purchase 1 unit of color.


  • 1≤T≤10^5
  • 1≤N≤10^5
  • Sum of N over all T in a test file does not exceed 10^6.
  • 1≤Ri,K,Di≤10^9
1
Expert's answer
2022-01-14T11:27:04-0500
Dear diyaP, your question requires a lot of work, which neither of our experts is ready to perform for free. We advise you to convert it to a fully qualified order and we will try to help you. Please click the link below to proceed: Submit order

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS