Untitled
unknown
plain_text
3 years ago
501 B
10
Indexable
#include <bits/stdc++.h>
using namespace std;
int n, m, sumaMAX=0, x, y;
vector <int> v;
int main()
{
ifstream fin("arme.in");
ofstream fout("arme.out");
fin>>n>>m;
for(int i=0; i<n; i++){
fin>>x;
v.push_back(x);
}
for(int i=0; i<m; i++){
fin>>y;
v.push_back(y);
}
sort(v.begin(), v.end(), greater<int>());
for(int i=0; i<n; i++){
sumaMAX+=v[i];
}
fout<<sumaMAX;
return 0;
}Editor is loading...