Problem Description
Given three integer arrays A=[A1,A2,⋯,AN], B=[B1,B2,⋯,BN], and C=[C1,C2,⋯,CN].
Please count how many triples (i,j,k) satisfy:
- 1≤i,j,k≤N.
- Ai<Bj<Ck.
The first line contains an integer N.
The second line contains N integers A1,A2,⋯,AN.
The third line contains N integers B1,B2,⋯,BN.
The fourth line contains N integers C1,C2,⋯,CN.
Output one integer representing the answer.
3
1 1 1
2 2 2
3 3 3
27
Hint
For 30% of the testdata, 1≤N≤100.
For 60% of the testdata, 1≤N≤1000.
For 100% of the testdata, 1≤N≤105, and 0≤Ai,Bi,Ci≤105.
Translated by ChatGPT 5