【资料图】
1、sort(opponent.begin(), opponent.end()); #include #include #include using namespace std;int main(){int N;while (cin >> N && N){int speech;vectoryuanzi;vectoropponent;int i;for (i = 0; i < N; ++i){cin >> speech;yuanzi.push_back(speech);}for (i = 0; i < N; ++i){cin >> speech;opponent.push_back(speech);}sort(yuanzi.begin(), yuanzi.end());sort(opponent.begin(), opponent.end());int x = 0;int ys = 0, ye = N-1, os = 0, oe = N-1;while(ys<=ye){if(yuanzi[ye] > opponent[oe]){ye--;x++;}else{ys++;}oe--;}if (x > N/2)cout << "YES" << endl;elsecout << "NO" << endl;}return 0;}。
本文就为大家分享到这里,希望小伙伴们会喜欢。