| 记录编号 | 190601 | 评测结果 | AAAAAAAAAA | ||
|---|---|---|---|---|---|
| 题目名称 | 1405.[UVa 11292] 勇者斗恶龙 | 最终得分 | 100 | ||
| 用户昵称 | 是否通过 | 通过 | |||
| 代码语言 | C++ | 运行时间 | 0.011 s | ||
| 提交时间 | 2015-10-03 20:27:58 | 内存使用 | 0.44 MiB | ||
#include<cstdio>
#include<algorithm>
using namespace std;
const int maxn=20020;
int a[maxn],b[maxn];
int main(){
freopen("DragonUVa.in","r",stdin);
freopen("DragonUVa.out","w",stdout);
int n,m;
int cur=0,cost=0;
scanf("%d%d",&n,&m);
for(int i=0;i<n;++i) scanf("%d",&a[i]);
for(int i=0;i<m;++i) scanf("%d",&b[i]);
sort(a,a+n);
sort(b,b+m);
for(int i=0;i<m;++i)
if(b[i]>=a[cur]){
cost+=b[i];
if(++cur==n) break;
}
if(cur<n) printf("Loowater is doomed\n");
else printf("%d\n",cost);
return 0;
}