#pragma GCC target("avx512f,avx512dq,avx512cd,avx512bw,avx512vl") #pragma GCC optimize("O3") #pragma GCC optimize("unroll-loops") #include using namespace std; using ll = long long; using pii = pair; using mii = map; const int INF = 1e9; const ll LINF = 1e18; #define MP(a,b) make_pair((a),(b)) #define MT(...) make_tuple(__VA_ARGS__) #define FOR(i,a,b) for(int i=(a);i<(b);++i) #define REP(i,x) for(int i=0;i<(int)(x);i++) #define REPS(i,x) for(int i=1;i<=(int)(x);i++) #define RREP(i,x) for(int i=((int)(x)-1);i>=0;i--) #define RREPS(i,x) for(int i=((int)(x));i>0;i--) #define ALL(x) (x).begin(),(x).end() #define IN(type,a) type a;cin >> a #define YES(n) cout << ((n) ? "YES" : "NO" ) << endl #define Yes(n) cout << ((n) ? "Yes" : "No" ) << endl #define COUT(x) cout << (x) << endl #define DCOUT(x,n) cout << fixed << setprecision(n) << (x) << endl int gcd(int x, int y){ if ((x==1)||(y==1)) { return 1; } if (x>y) { if (x%y==0) { return y; }else{ return gcd(y, x%y); } }else{ if (y%x==0) { return x; }else{ return gcd(x, y%x); } } } int main() { IN(int, n); vector a(n); vector b(n); REP(i, n){ cin >> a[i]; } REP(i, n){ cin >> b[i]; } double totalWin = 0; double total = 0; do { do { int win = 0; int lose = 0; REP(i, n){ if (a[i] > b[i]) { win++; }else{ lose++; } } if (win > lose) { totalWin++; } total++; } while (next_permutation(ALL(b))); } while (next_permutation(ALL(a))); COUT(totalWin); COUT(total); cout << fixed << setprecision(10) << totalWin/total << endl; }