http://acm.nyist.net/JudgeOnline/problem.php?pid=364
#include<cstdio>
#include<algorithm>
using namespace std;
int main(){
int n;
int a[1010];
int b[1010];
while(~scanf("%d",&n))
{
for(int i=1;i<=n;i++)
{
scanf("%d",a+i);
}
for(int i=1;i<=n;i++)
{
scanf("%d",b+i);
}
sort(a+1,a+1+n);
sort(b+1,b+1+n);
int ha,hb,la,lb;
ha=hb=n;
la=lb=1;
int tian=0,king=0;
while(la!=ha)
{
if(a[ha]>b[hb])
{
ha--;
hb--;
tian++;
}
else if(a[la]>b[lb])
{
la++;
lb++;
tian++;
}
else if(a[la]<b[hb])
{
king++;
la++;
hb--;
}
else break;//剩下的马的速度全部一样
}
if(a[ha]>b[lb]) tian++;//用田忌最快的马与king最慢的马比
else if(a[ha]<b[lb]) king++;//用田忌最快的马与king最慢的马比
printf("%d\n",(tian-king)*200);
}
}