#include<bits/stdc++.h>
using namespace std;
int n,tj[1005],ki[1005];
int tf,tl,kf,kl,win,lose;
bool cmp(int a,int b){
return a>b;
}
int main(){
while(cin>>n){
if(n==0)break;
for(int i=0;i<n;i++) cin>>tj[i];
for(int i=0;i<n;i++) cin>>ki[i];
sort(tj,tj+n,cmp);
sort(ki,ki+n,cmp);
win=lose=0;
tf=kf=0;
tl=kl=n-1;
for(int i=0;i<n;i++){//共比n场
//能赢的先赢掉
if(tj[tf]>ki[kf]){
win++;
tf++;
kf++;
}
else if(tj[tl]>ki[kl]){
win++;
tl--;
kl--;
}
//赢不了再考虑输的最优
else if(tj[tl]<ki[kf]){
lose++;
tl--;//这些马已经用过了,移动
kf++;
}
}
int sum=200*(win-lose);
cout<<sum<<endl;
}
}
hdu1052Tian Ji -- The Horse Racing
于 2021-03-24 20:00:50 首次发布