问题 C: Bansho Tan'in
题目描述
Bansho Tan'in (万象天引) is a powerful skill used by a character in Narumooo, Bessie's favorite anime. The skill allows the caster to obtain an object within a certain range to their hand, centering on the caster. After rigorous training, Bessie finally mastered this skill. Unfortunately, she is not very proficient yet and can only use the skill N times in total, with the effective range of the skill being unstable and represented by $L_i$ for the i-th use.
In other words, if Bessie stands at position p, during the i-th use of the skill, she can obtain an object located within the range $[p-L_i , p+L_i]$, provided that the object has not already been collected.
During a casual conversation, Bessie inadvertently learned that Farmer John hid his N treasures along a number line, with the i-th treasure located at position $X_i$. The task is to determine how many different positions p on the number line would allow Bessie to stand there and collect all of Farmer John's treasures using the skill exactly N times.
输入
The input is given from Standard Input in the following format:
$N$
$X_1 \qquad X_2 \qquad ... \qquad X_N$
$L_1 \qquad L_2 \qquad ... \qquad L_N$
输出
样例输入
3
-6 0 7
3 5 10
样例输出
6
提示
For the sample output,
satisfy the condition. For example, when , Bessie can grab all three treasures as follows.
- The first move can grab treasures at coordinates satisfying . Among them, grab the first treasure at coordinate .
- The second move can grab treasures at coordinates satisfying . Among them, grab the second treasure at coordinate .
- The third move can grab treasures at coordinates satisfying . Among them, grab the third treasure at coordinate .
Constraints
- $1\le N \le 200$
- $-10^{18} \le X_1 < X_2 < ... <X_N \le 10^{18} $
- $1 \le L_1 \le L_2 \le ... \le L_N \le 10^{18}$