解题思路:
注意事项:
参考代码:
#include <iostream>
#include<cstdio>
#include<cstring>
#include<set>
#include<string>
#include<vector>
#include<algorithm>
using namespace std;
bool paixu(int s1, int s2)
{
return s1 < s2;
}
int main()
{
int n;
int a[1000], b[1000];
a[0] = 0;
b[0] = 0;
while (cin >> n)
{
if (n == 0)
break;
for (int i = 1; i <= n; i++)
cin >> a[i];
for (int j = 1; j <= n; j++)
cin >> b[j];
sort(a,a+n,paixu);
sort(b,b+n,paixu);
int sum = 0;
for (int i = 1,j=1; i <= n; i++)
{
if (a[i] > b[j])
{
sum++;
j++;
}
}
if (sum > n / 2)
cout << "YES" << endl;
else
cout << "NO" << endl;
}
return 0;
}
0.0分
0 人评分