Quadruplet Sum - 2
medium
1. You are given four arrays(A1,A2,A3,A4) of integers. All arrays are of same length(N). 2. You have to find the count of all unique quadruplets(a,b,c,d) such that - A1[a] + A2[b] + A3[c] + A4[d] = 0.
Constraints
1 <= N <= 200 -10^3 <= elements of all arrays <= 10^3
Format
Input
5 lines, where the first line contains a number N, And every next line contains N space-separated integers.
Output
A number representing the count of all unique quadruplets having sum zero.
Example
Sample Input
2
1 2
-2 -1
-1 2
0 2
Sample Output
2