#include <iostream>
#include <istream>
#include <sstream>
#include <vector>
#include <stack>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <cstring>
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <numeric>
#include <chrono>
#include <ctime>
#include <cmath>
#include <cctype>
#include <string>
#include <cstdio>
#include <iomanip>
#include <thread>
#include <mutex>
#include <condition_variable>
#include <functional>
#include <iterator>
using namespace std;
int main()
{
int w, d;
while (cin >> w >> d && w && d) {
int a[15], b[15], h[30] = { 0 },ans = 0;
for (int i = 0; i < w; i++) {
cin >> a[i];
ans += a[i];
h[a[i]]++;
}
for (int i = 0; i < d; i++) {
cin >> b[i];
if (h[b[i]])h[b[i]]--;
else ans += b[i];
}
cout << ans << endl;
}
return 0;
}
uva1445
最新推荐文章于 2024-11-09 20:38:27 发布