#include #include using namespace std; int n, a[4], b[4]; int main() { scanf("%d", &n); for (int i = 0; i < n; i++) scanf("%d", &a[i]); for (int i = 0; i < n; i++) scanf("%d", &b[i]); int win = 0, counter = 0; sort(a, a+n); sort(b, b+n); do { do { counter++; int temp = 0; for (int i = 0; i < n; i++) if (a[i] > b[i]) temp++; if (temp * 2 > n) win++; } while (next_permutation(b, b+n)); } while (next_permutation(a, a+n)); printf("%f\n", (double)win / counter); }