Array Play

4

7 votes
Problem

Dolly is very fond of arrays and has got two arrays A and B. she takes these arrays to Lovish and ask him to calculate the total number of pairs such that A[i]>B[j] and i < j.

Help Lovish calculate the answer.

Input Format:

First line contains n denoting the total number of elements.The next line contains n space separated integers of array A.This line is again followed by n space separated integers of array B.

Output Format:

Print the total number of pairs satisfying the above condition.

Constraints:

1<=n<=200000

1<=A[i]<=10^6

1<=B[i]<=10^6

Time Limit: 1
Memory Limit: 256
Source Limit:
Explanation

possible pairs could be (5,2) , (5,3) and (6,3)

Editor Image

?