The first answer.
2025-11-21 22:10:58
发布于:浙江
0阅读
0回复
0点赞
第一篇题解
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
vector<int> a(n), b(n);
for (int i = 0; i < n; ++i)
cin >> a[i];
for (int i = 0; i < n; ++i)
cin >> b[i];
sort(a.begin(), a.end());
sort(b.begin(), b.end());
int count = 0;
while (true) {
bool valid = true;
for (int i = 0; i < n; ++i) {
if (i + count >= n) break;
if (a[i] > b[i + count]) {
valid = false;
break;
}
}
if (valid) break;
count++;
}
cout << count << endl;
return 0;
}
This is the end of the first answer.
这里空空如也







有帮助,赞一个