AtCoder Beginner Contest 160–E - Red and Green Apples

题目传送门

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
	ll X,Y,A,B,C;
	cin>>X>>Y>>A>>B>>C;
	vector<ll>a(A),b(B),c(C);
	for(int i=0;i<A;i++) cin>>a[i];
	for(int i=0;i<B;i++) cin>>b[i];
	for(int i=0;i<C;i++) cin>>c[i];
	sort(a.rbegin(),a.rend());
	sort(b.rbegin(),b.rend());
	for(int i=0;i<X;i++) c.push_back(a[i]);
	for(int i=0;i<Y;i++) c.push_back(b[i]);
	sort(c.rbegin(),c.rend());
	ll ans=0;
	for(int i=0;i<X+Y;i++) ans+=c[i];
	cout<<ans<<endl; 
	return 0;
}