AC题解
2023-09-01 10:01:38
发布于:广东
2阅读
0回复
0点赞
#include <bits/stdc++.h>
using namespace std;
#define int long long
signed main() {
int n;
cin >> n;
vector<int> cows(n);
for (int i = 0; i < n; ++i) {
cin >> cows[i];
}
vector<int> stalls(n);
for (int i = 0; i < n; ++i) {
cin >> stalls[i];
}
sort(cows.begin(), cows.end());
sort(stalls.begin(), stalls.end());
vector<int> possible_places(n, 0);
for (int i = 0; i < n; ++i) {
for (int j = 0; j < n; ++j) {
if (cows[i] <= stalls[j]) {
possible_places[i] += 1;
}
}
}
int product = 1;
for (int i = n - 1; i >= 0; --i) {
product *= possible_places[i] - (n - i - 1);
}
cout << product << endl;
return 0;
}
这里空空如也
有帮助,赞一个