1

ykj46 二百五 2024-07-28 20:51:39 6
#include<bits/stdc++.h>
using namespace std;
long long n,m,a[20005],b[20005];
long long ans=0,c=0; 
int main() {
	cin>>n>>m;
	for(int i=1;i<=n;i++){
		cin>>a[i];
	}
	sort(a+1,a+n+1);
	for(int i=1;i<=m;i++){
		cin>>b[i];
	}
	
	sort(b+1,b+m+1);
	int i=1,j=1;
	while(i<=n && j<=m){
		if(b[j]>=a[i]){
			ans+=b[j];
			i++;
			j++;
		}
		else j++;
	}
	if(i==n+1) cout<<ans;
	else cout<<"you died!";
	return 0;
}
{{ vote && vote.total.up }}