brucehb


私信TA

用户名:brucehb

访问量:2878

签 名:

等  级
排  名 1432
经  验 2776
参赛次数 0
文章发表 27
年  龄 0
在职情况 学生
学  校 北航
专  业

  自我简介:

解题思路:

注意事项:

参考代码:

#include<bits/stdc++.h>

using namespace std;


const int N = 1e5 + 7;

int a[N];

int b[N];

int c[N];

int n;


int main()

{

    cin >> n;

    for (int i = 0; i < n; i++) {

        cin >> a[i];

    }

    for (int i = 0; i < n; i++) {

        cin >> b[i];

    }

    for (int i = 0; i < n; i++) {

        cin >> c[i];

    }

    int res = 0;

    sort(a, a + n);

    sort(b, b + n);

    sort(c, c + n);

    int p = 0;

    int q = 0;

    for (int i = 0; i < n; i++) {

        int v = b[i];

        while (p < n && a[p] < v) {

            p++;

        }

        while (q < n && c[q] <= v) {

            q++;

        }

        

        res += p * (n - q);

    }

    cout << res << endl;


    return 0;

}


 

0.0分

4 人评分

看不懂代码?想转换其他语言的代码? 或者想问其他问题? 试试问问AI编程助手,随时响应你的问题:

编程语言转换

万能编程问答

代码解释器

  评论区