cswork / OA打开练习工作台

AmazonOA #281

Maximum User Traffic

估计中等可在线判题

考点(AI 标注)前缀和区间

User i is online every day from login[i] to logout[i], inclusive at both ends; on the same day, logins happen before logouts. Find how many days have an online count equal to the global maximum online count; do not return the count itself.

输入格式

The first line contains n, the second line contains login, and the third line contains logout. 1≤n≤100000, 0≤login[i]≤logout[i]≤100000.

输出格式

Output a single integer, the answer.

样例 1

输入:

3
1 2 7
3 4 7

输出:

2

样例 2

输入:

1
0
0

输出:

1

样例 3

输入:

2
1 3
1 3

输出:

2

样例说明

The answers are 2, 1 and 2 respectively. In the first example, days 2 and 3 both have two users online; in the third example, two non-adjacent days both reach the peak of 1.