# 递增三元组
给定三个整数数组  
A = [A1, A2, ... AN],   
B = [B1, B2, ... BN],   
C = [C1, C2, ... CN]，  
请你统计有多少个三元组(i, j, k) 满足：
1. 1 <= i, j, k <= N  
2. Ai < Bj < Ck  


**输入格式**

第一行包含一个整数N。  
第二行包含N个整数A1, A2, ... AN。  
第三行包含N个整数B1, B2, ... BN。  
第四行包含N个整数C1, C2, ... CN。  

对于30%的数据，1 <= N <= 100    
对于60%的数据，1 <= N <= 1000   
对于100%的数据，1 <= N <= 100000 0 <= Ai, Bi, Ci <= 100000   


**输出格式**

一个整数表示答案

**样例输入**

```
3
1 1 1
2 2 2
3 3 3
```

**样例输出**

```
27
```


## aop
### before
```cpp
#include <iostream>
#include <cstring>

using namespace std;

typedef long long LL;

const int N = 1e5 + 10;
int a[N], b[N], c[N], sa[N], sc[N], s[N]; 

```
### after
```cpp

```

## 答案
```cpp
int main()
{
    int n;
    cin >> n;
    for (int i = 0; i < n; i++)
        cin >> a[i], a[i]++; 
    for (int i = 0; i < n; i++)
        cin >> b[i], b[i]++;
    for (int i = 0; i < n; i++)
        cin >> c[i], c[i]++;

    for (int i = 0; i < n; i++)
        s[a[i]]++; 
    for (int i = 1; i < N; i++)
        s[i] += s[i - 1]; 
    for (int i = 0; i < n; i++)
        sa[i] = s[b[i] - 1]; 

    memset(s, 0, sizeof s);

    for (int i = 0; i < n; i++)
        s[c[i]]++;
    for (int i = 1; i < N; i++)
        s[i] += s[i - 1];
    for (int i = 0; i < n; i++)
        sc[i] = s[N - 1] - s[b[i]]; 

    LL res = 0;
    for (int i = 0; i <= n; i++)
        res += (LL)sa[i] * sc[i];
    cout << res;
}
```
## 选项

### A
```cpp
int main()
{
    int n;
    cin >> n;
    for (int i = 0; i < n; i++)
        cin >> a[i], a[i]++; 
    for (int i = 0; i < n; i++)
        cin >> b[i], b[i]++;
    for (int i = 0; i < n; i++)
        cin >> c[i], c[i]++;

    for (int i = 0; i < n; i++)
        s[a[i]]++; 
    for (int i = 1; i < N; i++)
        s[i] += s[i - 1]; 
    for (int i = 0; i < n; i++)
        sa[i] = s[b[i] - 1]; 

    memset(s, 0, sizeof s);

    for (int i = 0; i < n; i++)
        s[c[i]]++;
    for (int i = 1; i < N; i++)
        s[i] += s[i - 1];
    for (int i = 0; i < n; i++)
        sc[i] = s[N] - s[b[i]]; 

    LL res = 0;
    for (int i = 0; i <= n; i++)
        res += (LL)sa[i] * sc[i];
    cout << res;
}
```

### B
```cpp
int main()
{
    int n;
    cin >> n;
    for (int i = 0; i < n; i++)
        cin >> a[i], a[i]++; 
    for (int i = 0; i < n; i++)
        cin >> b[i], b[i]++;
    for (int i = 0; i < n; i++)
        cin >> c[i], c[i]++;

    for (int i = 0; i < n; i++)
        s[a[i]]++; 
    for (int i = 1; i < N; i++)
        s[i] += s[i - 1]; 
    for (int i = 0; i < n; i++)
        sa[i] = s[b[i] - 1]; 

    memset(s, 0, sizeof s);

    for (int i = 0; i < n; i++)
        s[c[i]]++;
    for (int i = 1; i < N; i++)
        s[i] = s[i - 1];
    for (int i = 0; i < n; i++)
        sc[i] = s[N - 1] - s[b[i]]; 

    LL res = 0;
    for (int i = 0; i <= n; i++)
        res += (LL)sa[i] * sc[i];
    cout << res;
}
```

### C
```cpp
int main()
{
    int n;
    cin >> n;
    for (int i = 0; i < n; i++)
        cin >> a[i], a[i]++; 
    for (int i = 0; i < n; i++)
        cin >> b[i], b[i]++;
    for (int i = 0; i < n; i++)
        cin >> c[i], c[i]++;

    for (int i = 0; i < n; i++)
        s[a[i]]++; 
    for (int i = 1; i < N; i++)
        s[i] += s[i - 1]; 
    for (int i = 0; i < n; i++)
        sa[i] = s[b[i] - 1]; 

    memset(s, 0, sizeof s);

    for (int i = 0; i < n; i++)
        s[c[i]]++;
    for (int i = 1; i < N; i++)
        s[i] = s[i - 1];
    for (int i = 0; i < n; i++)
        sc[i] = s[N - 1] - s[b[i] - 1]; 

    LL res = 0;
    for (int i = 0; i <= n; i++)
        res += (LL)sa[i] * sc[i];
    cout << res;
}
```
