problem
solution
codes
//优先打价值最大的(如果能打的化)
#include<iostream>
#include<algorithm>
using namespace std;
struct d{ int t, w; }a[110];
bool cmp(d a, d b){ return a.w>=b.w; }
int n, book[110], ans;
int main(){
cin>>n;
for(int i = 0; i < n; i++)cin>>a[i].t;
for(int i = 0; i < n; i++)cin>>a[i].w;
sort(a, a+n, cmp);
for(int i = 0; i < n; i++)
for(int j = a[i].t; j >= 1; j--)
if(!book[j]){ ans += a[i].w; book[j] = 1; break; }
cout<<ans;
return 0;
}