Marks :20
: 2 | : 1
You are given 2 arrays $$$a_1,a_2...a_n$$$ and $$$b_1,b_2,...b_n$$$. In each steps you can set $$$a_i$$$ to $$$a_i-b_i$$$ if $$$a_i>=b_i$$$
Determine minimum number of steps to make all $$$a's$$$ equal.
The first line contains $$$1\le n \le 5000$$$.
The second line contains $$$n$$$ space separated integers where $$$i_{th}$$$ integer represents $$$1\le a_i \le 5000$$$.
The third line contains $$$n$$$ space separated integers where $$$i_{th}$$$ integer represents $$$1\le b_i \le 5000$$$.
Print minimum steps required to make all $$$a's$$$ equal . If it is not possible print $$$-1$$$.
2 5 6 4 3
-1
5 5 7 10 5 15 2 2 1 3 5
8
You need to login to view your submissions.
You need to login to view all submissions.
Result : Executed
Feel something is wrong with the test cases?
Result : Accepted
Test Cases :
But to Run or Submit the Problem, you need to Log In.
Continue to Log InYour challenge has been submitted successfully.
You will get a response soon via WhatsApp or Email.
Do let us know your issue.