CF1324D.Pair of Topics

普及/提高-

通过率:0%

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

The next lecture in a high school requires two topics to be discussed. The ii -th topic is interesting by aia_i units for the teacher and by bib_i units for the students.

The pair of topics ii and jj ( i<ji < j ) is called good if ai+aj>bi+bja_i + a_j > b_i + b_j (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 nn ( 2n21052 \le n \le 2 \cdot 10^5 ) — the number of topics.

The second line of the input contains nn integers a1,a2,,ana_1, a_2, \dots, a_n ( 1ai1091 \le a_i \le 10^9 ), where aia_i is the interestingness of the ii -th topic for the teacher.

The third line of the input contains nn integers b1,b2,,bnb_1, b_2, \dots, b_n ( 1bi1091 \le b_i \le 10^9 ), where bib_i is the interestingness of the ii -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
首页