Submission #3721138


Source Code Expand

#if !defined(__clang__) && defined(__GNUC__)
#include <bits/stdc++.h>
#else
#include <cstdlib>
#include <climits>
#include <iostream>
#include <cstdint>
#include <vector>
#include <string>
#include <complex>
#include <bitset>
#include <queue>
#include <deque>
#include <stack>
#include <utility>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <regex>
#endif //  !defined(__clang__) && defined(__GNUG__)
#include <boost/lexical_cast.hpp>
#include <boost/algorithm/string.hpp>
#include <boost/multi_array.hpp>
#include <boost/optional.hpp>
#include <boost/math/common_factor_rt.hpp>  // https://boostjp.github.io/tips/math.html
#include <boost/dynamic_bitset.hpp>  // https://boostjp.github.io/tips/dynamic_bitset.html

constexpr int64_t DIV1097 = 1000000007LL;

using namespace std;

int main()
{
    int64_t N;
    std::cin >> N;

    std::vector<int64_t> A;
    for (decltype(N) i = 0; i < N; ++i) {
        int64_t t;
        std::cin >> t;
        A.push_back(t);
    }

    std::vector<int64_t> B;
    for (decltype(N) i = 0; i < N; ++i) {
        int64_t t;
        std::cin >> t;
        B.push_back(t);
    }

    std::vector<int64_t> C;
    for (decltype(N) i = 0; i < N; ++i) {
        int64_t t;
        std::cin >> t;
        C.push_back(t);
    }

    std::sort(std::begin(A), std::end(A));
    std::sort(std::begin(B), std::end(B));
    std::sort(std::begin(C), std::end(C));

    int64_t ans = 0;
    for (int64_t i = 0; i < N; ++i) {
        auto b = B[i];
        auto c_count = std::distance(std::upper_bound(C.begin(), C.end(), b), C.end());
        auto a_count = std::distance(A.begin(), std::lower_bound(A.begin(), A.end(), b));

        ans += c_count * a_count;
    }

    std::cout << ans << std::endl;

    return 0;
}

Submission Info

Submission Time
Task C - Snuke Festival
User sumomoneko
Language C++14 (GCC 5.4.1)
Score 300
Code Size 1786 Byte
Status AC
Exec Time 151 ms
Memory 3316 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 300 / 300
Status
AC × 3
AC × 32
Set Name Test Cases
Sample s1.txt, s2.txt, s3.txt
All 01.txt, 02.txt, 03.txt, 04.txt, 05.txt, 06.txt, 07.txt, 08.txt, 09.txt, 10.txt, 11.txt, 12.txt, 13.txt, 14.txt, 15.txt, 16.txt, 17.txt, 18.txt, 19.txt, 20.txt, 21.txt, 22.txt, 23.txt, 24.txt, 25.txt, 26.txt, 27.txt, 28.txt, 29.txt, s1.txt, s2.txt, s3.txt
Case Name Status Exec Time Memory
01.txt AC 147 ms 3316 KB
02.txt AC 146 ms 3316 KB
03.txt AC 121 ms 3316 KB
04.txt AC 121 ms 3316 KB
05.txt AC 85 ms 3316 KB
06.txt AC 85 ms 3316 KB
07.txt AC 73 ms 3316 KB
08.txt AC 73 ms 3316 KB
09.txt AC 62 ms 3316 KB
10.txt AC 64 ms 3316 KB
11.txt AC 59 ms 3316 KB
12.txt AC 59 ms 3316 KB
13.txt AC 143 ms 3316 KB
14.txt AC 144 ms 3316 KB
15.txt AC 141 ms 3316 KB
16.txt AC 141 ms 3316 KB
17.txt AC 145 ms 3316 KB
18.txt AC 143 ms 3316 KB
19.txt AC 148 ms 3316 KB
20.txt AC 57 ms 3316 KB
21.txt AC 58 ms 3316 KB
22.txt AC 139 ms 3316 KB
23.txt AC 141 ms 3316 KB
24.txt AC 142 ms 3316 KB
25.txt AC 151 ms 3316 KB
26.txt AC 1 ms 256 KB
27.txt AC 1 ms 256 KB
28.txt AC 1 ms 256 KB
29.txt AC 1 ms 256 KB
s1.txt AC 1 ms 256 KB
s2.txt AC 1 ms 256 KB
s3.txt AC 1 ms 256 KB