#include #include #include #include #include #include #include #include using namespace std; int main() { int n, a[4], b[4], x[] {0, 1, 2, 3}, v {}, s {}; cin >> n; for (int i = 0; i < n; ++i) cin >> a[i]; for (int i = 0; i < n; ++i) cin >> b[i]; do { int vs {}; for (int i = 0; i < n; ++i) { if (b[x[i]] < a[i]) ++vs; } if (n < vs * 2) ++v; ++s; } while (next_permutation(x, x + n)); cout << (double)v / s << '\n'; }