P28117 [洛谷] [NOISG 2023 Qualification] Burgers
入门
题目描述

Problem Description

Lobster Kai runs a burger shop. Making a burger requires $n$ types of ingredients, and he has $x_i$ units of the $i$-th ingredient.

He has two burger recipes, each requiring $a_i$ and $b_i$ units of the $i$-th ingredient respectively.

Calculate the maximum number of burgers Kai can make with these ingredients.

Input Format

The first line contains a positive integer $n$.

The second line contains $n$ integers representing $x$.

The third line contains $n$ integers representing $a$.

The fourth line contains $n$ integers representing $b$.

Output Format

A single line containing an integer representing the maximum number of burgers that can be made.

Sample Input and Output

Sample Input #1

3
14 10 100
3 1 1
2 3 1

Sample Output #1

5

Sample Input #2

2
83 72
1 3
1 3

Sample Output #2

24

Notes/Hints

Sample #1 Explanation

Kai can make 3 burgers of the first type and 2 burgers of the second type.

Sample #2 Explanation

Kai can make 24 burgers of either the first type or the second type.

Data Range

Subtask Score Special Conditions
0 0 Examples
1 9 For all $1 \le i \le n$, $a_i = b_i$.
2 17 $n, x_i \le 100$
3 25 $n, x_i \le 1500$
4 49 None

For $100\%$ of the data, $1 \le n \le 100000, 1 \le x_i, a_i, b_i \le 10^9$.

输入格式

见题面 Input 部分

输出格式

见题面 Output 部分

样例输入
3 14 10 100 3 1 1 2 3 1
样例输出
5