#include #include #include #include #include #include using namespace std; int factorial(int n) { if (n == 1) { return 1; } else { return n * factorial(n - 1); } } int main() { int n; cin >> n; vector a(n, 0), b(n, 0), order(n , 0); for (int i = 0; i < n; i++) { cin >> a[i]; order[i] = i; } for (int i = 0; i < n; i++) { cin >> b[i]; } int total_win = 0; do { int wins = 0; for (int i = 0; i < n; i++) { if (a[i] > b[order[i]]) { wins++; } } if (wins > n / 2) { total_win++; } } while (next_permutation(order.begin(), order.end())); double ans = 1.0 * total_win / factorial(n); printf("%.3f\n", ans); return 0; }