// 田忌赛马
#include <bits/stdc++.h>
using namespace std;

const int maxn=2005;
int t[maxn],q[maxn];
int money,tlow,qlow,thigh,qhigh;

int main() {
int n;
cin>>n;
for(int i=0; i<n; i++) cin>>t[i];
for(int i=0; i<n; i++) cin>>q[i];
sort(t,t+n);
sort(q,q+n);

tlow=qlow=0;
thigh=qhigh=n-1;

while(tlow<=thigh) {
if(t[thigh]>q[qhigh]) {
money+=200;
thigh--;
qhigh--;
} else if(t[thigh]<q[qhigh]) {
money-=200;
tlow++;
qhigh--;
} else {
if(t[tlow]>q[qlow]) {
money+=200;
tlow++;
qlow++;
} else {
if(t[tlow]<q[qhigh]) money-=200;
tlow++;
qhigh--;
}
}
}
cout<<money<<endl;

return 0;
}
全部评论

相关推荐

12-10 22:48
武汉大学 Java
点赞 评论 收藏
分享
10-31 22:23
门头沟学院 Java
天然不是卷王:太好了 佬的金九银十结束,等offer吐出来,我的金11银12就要开始了
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务