#include #include #include using namespace std; int main() { int n; cin >> n; vector a(n), b(n); int total = 0, win_a = 0; 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()); do { vector b_ = b; do { total++; int win_a_tmp = 0; for (int i = 0; i < n; i++) { if (a[i] > b_[i]) win_a_tmp++; } if (win_a_tmp > (n / 2)) win_a++; } while (next_permutation(b_.begin(), b_.end())); } while (next_permutation(a.begin(), a.end())); cout << double(win_a) / total << endl; return 0; }