LCC/Moose '19 Contest 2 S1 - ?️eans

View as PDF

Submit solution

Points: 3 (partial)
Time limit: 2.0s
Memory limit: 64M

Author:
Problem type

Justin likes beans. In fact, he likes beans so much he wants to make a bean stew. There are N different bean species and Justin has c_n beans of the n^{th} species.

Justin's bean stew recipe requires d_n beans of the n^{th} species to make. Justin is very hungry, so help him find out how many bean stews he can possibly make!

Input Specification

The first line contains a single integer N (1\leq N\leq 10^5), the number of bean species.

The next line contains N space separated integers c_n (1\leq c_n\leq 10^8), where c_n represents how many beans of the n^{th} species Justin has.

The final line contains N space separated integers d_n (1\leq d_n\leq 10^8), where d_n represents how many beans of the n^{th} species is required by the bean stew recipe.

Output Specification

Output a single integer representing the total number of bean stews Justin can make.

Sample Input

3
7 10 2
2 4 1

Sample Output

2

Explanation for Sample Output

Making 2 bean stews takes 4 beans of the 1^{st} species, 8 beans of the 2^{nd} species and 2 beans of the 3^{rd} species. Justin doesn't have enough ingredients to make any more stews after that.


Comments

There are no comments at the moment.