/** * yukicoder No.133 */ #include #include #include typedef std::vector VI; int main() { int N, num_win, num_game, each_win; std::cin >> N; VI A(N), B(N); for (int i = 0; i < N; i++) std::cin >> A.at(i); for (int i = 0; i < N; i++) std::cin >> B.at(i); std::sort(A.begin(), A.end()); std::sort(B.begin(), B.end()); num_win = 0, num_game = 0; do { do { each_win = 0; for (int i = 0; i < N; i++) { if (A.at(i) > B.at(i)) each_win++; else if (A.at(i) < B.at(i)) each_win--; } if (each_win > 0) num_win++; num_game++; } while(std::next_permutation(B.begin(),B.end())); } while(std::next_permutation(A.begin(), A.end())); std::cout << (double)num_win/(double)num_game << "\n"; }