CF1324D.Pair of Topics
普及/提高-
通过率:0%
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
The next lecture in a high school requires two topics to be discussed. The i -th topic is interesting by ai units for the teacher and by bi units for the students.
The pair of topics i and j ( i<j ) is called good if ai+aj>bi+bj (i.e. it is more interesting for the teacher).
Your task is to find the number of good pairs of topics.
输入格式
The first line of the input contains one integer n ( 2≤n≤2⋅105 ) — the number of topics.
The second line of the input contains n integers a1,a2,…,an ( 1≤ai≤109 ), where ai is the interestingness of the i -th topic for the teacher.
The third line of the input contains n integers b1,b2,…,bn ( 1≤bi≤109 ), where bi is the interestingness of the i -th topic for the students.
输出格式
Print one integer — the number of good pairs of topic.
输入输出样例
输入#1
5 4 8 2 6 2 4 5 4 1 3
输出#1
7
输入#2
4 1 3 2 4 1 3 2 4
输出#2
0