#include <algorithm>
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
int n;
cin >> n;
vector<int> a(n);
vector<int> b(n);
for (int i = 0; i < n; i++)
cin >> a[i];
for (int i = 0; i < n; i++)
cin >> b[i];
vector<int> p(n, 0);
iota(p.begin(), p.end(), 0);
ll win = 0LL;
ll lose = 0LL;
ll draw = 0LL;
do {
int dark = 0;
int yxl = 0;
for (int i = 0; i < n; i++) {
if (a[i] > b[p[i]])
dark++;
else if (a[i] < b[p[i]])
yxl++;
}
if (dark > yxl)
win++;
else if (dark < yxl)
lose++;
else
draw++;
} while (next_permutation(p.begin(), p.end()));
cout << win << " " << lose << " " << draw << endl;
}
暴力枚举。

京公网安备 11010502036488号