import java.io.BufferedReader;
import java.io.IOException;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.*;
import java.util.*;
public class Main{
static int N=100010;
static int a[]=new int[N];
static int b[]=new int[N];
static int c[]=new int[N];
public static void main(String []args) throws IOException {
BufferedReader bf=new BufferedReader(new InputStreamReader(System.in));
PrintWriter pw = new PrintWriter(new OutputStreamWriter(System.out));
int n=Integer.parseInt(bf.readLine());
String s[]=bf.readLine().split(" ");
for(int i=1;i<=n;i++)a[i]=Integer.parseInt(s[i-1]);
for(int i=1;i<=n;i++)b[i]=Integer.parseInt(s[i-1]);
for(int i=1;i<=n;i++)c[i]=Integer.parseInt(s[i-1]);
Arrays.sort(a,1,n+1);
Arrays.sort(b,1,n+1);
Arrays.sort(c,1,n+1);
//a[i]
long res=0;
for(int i=1;i<=n;i++) {
int la=0;
int ra=n+1;
//二分出数组元素的下标
while(la<ra) {
int mid=la+ra>>1;
if(a[mid]>=b[i])ra=mid;
else la=mid+1;
}
int lb=0;
int rb=n+1;
while(lb<rb) {
int mid=lb+rb+1>>1;
if(c[mid]<=b[i])lb=mid;
else rb=mid-1;
}
if(la==0||rb==n+1)continue;
res+=(long)(la-1)*(n-lb);
}
System.out.println(res);
}
}
☀️☀️☀️☀️☀️☀️
后续有补充,持续更新中
喜欢的伙伴点点赞,关个注