P29604 [洛谷] [COCI2018-2019#5] Jarvis
普及+
题目描述

Problem Description

Ivan has $N$ drones, each with an initial attribute value and a required attribute value for deployment. He can choose an integer $X$ (which does not have to be positive) to add to the initial attribute value of all drones.

Determine the maximum number of drones that can be deployed (i.e., their attribute values match the required attribute values).

Input Format

The first line contains an integer $N$, the number of drones.

The second line contains $N$ integers $A_i$, representing the initial attribute values of the drones.

The third line contains $N$ integers $B_i$, representing the required attribute values for deployment.

Output Format

Output the maximum number of drones that can be deployed.

Sample Input and Output

Sample Input #1

1
1
2

Sample Output #1

1

Sample Input #2

2
0 0
1 1

Sample Output #2

2

Sample Input #3

2
1 2
5 5

Sample Output #3

1

Notes

Sample 3 Explanation

If $X = 3$, the attribute values become $1 + 3 = 4$ and $2 + 3 = 5$, so only the second drone can be deployed. If $X = 4$, the attribute values become $5$ and $6$, so only the first drone can be deployed. It can be proven that there is no integer $X$ that allows both drones to be deployed.

Data Size and Constraints

For $40\%$ of the data, $-10 \le A_i, B_i \le 10$.

For $100\%$ of the data, $1 \le N \le 10^5$, $-10^6 \le A_i, B_i \le 10^6$.

Notes

This problem's score is set according to the original COCI contest, with a maximum score of $70$.

The problem is translated from COCI2018-2019 CONTEST #5 T2 Jarvis.

输入格式

见题面 Input 部分

输出格式

见题面 Output 部分

样例输入
1 1 2
样例输出
1