1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
|
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
int main() {
int na,nb,nc;
cin >> na>>nb>>nc;
vector<uint64_t> A(na);
for (auto& A_i : A) { cin >> A_i; }
vector<uint64_t> B(nb);
for (auto& B_i : B) { cin >> B_i; }
vector<uint64_t> C(nc);
for (auto& C_i : C) { cin >> C_i; }
sort(A.begin(), A.end());
sort(B.begin(), B.end());
sort(C.begin(), C.end());
vector<uint64_t> v1(A.size() + B.size()+1);
vector<uint64_t> v2(v1.size() + C.size()+1);
merge(A.begin(), A.end(), B.begin(), B.end(), v1.begin());
merge(v1.begin(), v1.end(), C.begin(), C.end(), v2.begin());
int cnt1,cnt2,sum=0;
for(int i=0;i<B.size();i++)
{
vector<uint64_t>::iterator a=upper_bound(A.begin(),A.end(),B[i]);
cnt1=distance(a,A.end());
vector<uint64_t>::iterator c=upper_bound(C.begin(),C.end(),B[i]);
cnt2=distance(c,C.end());
sum+=cnt1*cnt2;
}
cout<<sum;
return 0;
}
|