AmazonOA #245
How Many Games Did the First Team Win?
估计中等可在线判题
Each of two teams has n people. For each same-index pair i<j, the first team wins if the skill sum of its two people is strictly greater than that of the corresponding two people on the second team; a tie is not a win. Count the wins modulo 1000000007. The index typesetting on this page is missing; the corresponding-index rule is restored from the full statement and identical examples of amazon-group1-win-count.md in the same snapshot.
输入格式
The first line contains n, the second line the first team's skills, and the third line the second team's skills. 2≤n≤100000; all skills are in 1..10^9.
输出格式
Output a single integer, the answer.
样例 1
输入:
3
1 2 3
3 2 1
输出:
1
样例 2
输入:
2
5 5
5 5
输出:
0
样例 3
输入:
3
2 2 2
1 1 1
输出:
3
样例说明
The answers are 1, 0 and 3. You cannot sort the two teams separately and then subtract.