#include #include #include int main() { int N; std::cin >> N; std::vector A(N), B(N); for (int i=0; i> A[i]; for (int i=0; i> B[i]; std::sort(std::begin(A), std::end(A)); std::sort(std::begin(B), std::end(B)); int total = 0; int n_win = 0; do { do { int score = 0; for (int i=0; i B[i]) { score++; } else if (A[i] < B[i]) { score--; } } if (score > 0) n_win++; total++; } while( std::next_permutation(std::begin(B), std::end(B)) ); } while( std::next_permutation(std::begin(A), std::end(A)) ); std::cout << static_cast(n_win) / total << std::endl; }