#abc199b. B - Intersection
B - Intersection
Score : points
问题描述
给定两个长度均为 的序列: 和 。
任务是找出满足以下条件的整数 的个数:
- 对于所有满足 的整数 ,有 成立。
以上为通义千问 qwen-max 翻译,仅供参考。
Problem Statement
You are given sequences of length each: and .
Find the number of integers satisfying the following condition:
- holds for every integer such that .
Constraints
- All values in input are integers.
Input
Input is given from Standard Input in the following format:
Output
Print the answer.
Sample Input 1
2
3 2
7 5
Sample Output 1
3
must satisfy both and .
There are three such integers: , , and .
Sample Input 2
3
1 5 3
10 7 3
Sample Output 2
0
There may be no integer satisfying the condition.
Sample Input 3
3
3 2 5
6 9 8
Sample Output 3
2