#include #define ALL(a) begin(a), end(a) #define REP(i, n) for (int i = 0; i < static_cast(n); ++i) using ll = long long; using ld = long double; using byte = unsigned char; using int128_t = __int128_t; using uint128_t = __uint128_t; using namespace std; constexpr int IINF = 1e9 + 1; constexpr ll LINF = 1e18 + 1; // ================ Comment ================ // // ========================================= int main(int argc, char **argv) { int N; cin >> N; vector A(N), B(N); for (auto i = 0; N > i; i++) { cin >> A[i]; } for (auto i = 0; N > i; i++) { cin >> B[i]; } sort(ALL(A)); sort(ALL(B)); auto n_game_Awin = 0; auto n_games = 0; do { do { auto n_turn_Awin = 0; auto n_turn_Bwin = 0; for (auto i = 0; N > i; i++) { if (A[i] > B[i]) { n_turn_Awin++; } else { n_turn_Bwin++; } } if (n_turn_Awin > n_turn_Bwin) { n_game_Awin++; } n_games++; } while (next_permutation(ALL(B))); } while (next_permutation(ALL(A))); cout << setprecision(15) << (double)n_game_Awin / n_games << endl; return EXIT_SUCCESS; }