nyist 364

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了nyist 364相关的知识,希望对你有一定的参考价值。

#include <stdio.h>
#include <algorithm>
using namespace std;

int main(){

int n,t[1005],k[1005];
while(scanf("%d",&n)==1){
for(int i=1;i<=n;i++)
scanf("%d",&t[i]);
sort(t+1,t+n+1);
for(int i=1;i<=n;i++)
scanf("%d",&k[i]);
sort(k+1,k+n+1);
int tf=1,tl=n,kf=1,kl=n;
int g_w=0,g_l=0,z=n;
while(z--){
if(t[tf]>k[kf]){
g_w++;
tf++;
kf++;
}else if(t[tl]>k[kl]){
g_w++;
tl--;
kl--;}
else{
if(t[tf]<k[kl])
g_l++;
tf++;
kl--;
}
}
printf("%d\n",(g_w-g_l)*200);
}
return 0;
}

/*

贪心

最小与最小比较,之后就是最大于最大,最小与最大

*/

以上是关于nyist 364的主要内容,如果未能解决你的问题,请参考以下文章

[NYIST15]括号匹配(区间dp)

[NYIST16]矩形嵌套(DP,最长上升子序列)

[NYIST737]石子合并(区间dp)

nyist oj 311 全然背包 (动态规划经典题)

nyist_21(三个水杯)(BFS)

nyist 20 吝啬的国度(dfs)