问题
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <map>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;
typedef long long LL;
const int maxn=100+5;
int w,d,wi[maxn],t,kase=0;
int main(void){
while(scanf("%d%d",&w,&d)==2 && w && d){
int ans=0;
memset(wi,0,sizeof(wi));
for(int i=0;i<w;++i){
scanf("%d",&t);
ans+=t; //摆出主视图每列所需要的数量
++wi[t]; //记录
}
for(int i=0;i<d;++i){
scanf("%d",&t);
if(wi[t]) --wi[t]; //把对应的列移动,摆出相应的主视图
else ans+=t;
}
printf("%d\n",ans);
}
return 0;
}