Submit | All submissions | Best solutions | Back to list |
GSTOZERO - Sum to Zero |
You are given three arrays A, B, and C. Each array have N elements. You have to find how many triplets (i, j, k) satisfies A[i] + B[j] + C[k] = 0. Note that triplet (1, 1, 2) is considered different from triplet (2, 1, 1).
1 ≤ N ≤ 1000, -1 000 000 000 ≤ A[i], B[i], C[i] ≤ 1 000 000 000
Input
The first line will consist of an integer N.
The second line will consist of N integers separated by space, representing the array A. The third line will consist of N integers separated by space, representing the array B. The fourth line will consist of N integers separated by space, representing the array C.
Output
A single integer as requested in the problem statement.
Example
Input: 2 -6 -1 10 2 -4 -9 Output: 2
Added by: | jonathanirvings |
Date: | 2015-12-22 |
Time limit: | 1s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All except: ASM64 GOSU JS-MONKEY |
Resource: | Classic |