Untitled

mail@pastecode.io avatar
unknown
plain_text
2 years ago
501 B
2
Indexable
Never
#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;
}