#include using namespace std; #include using namespace atcoder; #define rep(i,n) for (int i = 0; i < (n); ++i) #define rrep(i,n) for (int i = n-1; i >= (0); --i) #define IO ios::sync_with_stdio(0),cin.tie(0); #define fi first #define se second #define all(x) x.begin(), x.end() #define pb push_back #define pf push_front #define eb emplace_back #define ef emplace_front #define bpop(x) __builtin_popcount(x) #define bpopll(x) __builtin_popcountll(x) using mint = modint998244353; /* using mint = modint1000000007; */ /* using mint = static_modint<998244353>; */ /* using mint = modint; */ /* mint::set_mod(mod); */ template bool chmin(T &a, const T &b) { if (a > b) { a = b; return true; } return false; } template bool chmax(T &a, const T &b) { if (a < b) { a = b; return true; } return false; } void print_imp() {} template void print_imp(First f, Rest... r) { cout< void print(Args... args) { print_imp(args...); cout << endl; } template void print_pair(vector &v) { for (auto [a,b] : v) print(a, b); } template void print_vec(vector &v) { rep(i, v.size()) {cout << v[i]; if (i == v.size()-1) cout << endl; else cout << " ";} } template void print_mint_vec(vector &v) { for (auto e : v) cout << e.val() << " "; cout << endl; } template void print_mat(vector> &m) { for (auto v : m) print_vec(v); } template void print_mint_mat(vector> &m) { for (auto v : m) print_mint_vec(v); } template void print_bit(T s, int n) { rep(i, n) {if (s>>i&1) cout<<1; else cout<<0;} cout< using min_pq = priority_queue, greater>; template using vt = vector; template using vvt = vt>; using ll = long long; using pii = pair; using pil = pair; using pli = pair; using pll = pair; using pdd = pair; const ll MOD = 1e9 + 7; const int INF = 1001001001; const ll LINF = 4e18; const double PI = 3.14159265358979323846; /* - comb modintのnCk,nPk - matrix 行列累乗 - RMQ/RMAQ_min/max lazy_segtree 区間加算/変更、区間最小値/最大値取得 - RSQ/RSAQ lazy_segtree 区間加算/変更、区間和取得 - Eratosthenes 高速素因数分解可能なエラトステネスのふるい - dydx, dydx8 dy,dx={右,下,左,上} - grid_continue if (i < 0 || j < 0 || i >= h || j >= w) continue; - Pascal パスカルの三角形 - Graph グラフ関連のライブラリ - dijkstra ダイクストラ法 - bellman_ford ベルマンフォード、負のサイクル検出 - topological_sort トポロジカルソート - find_cycle_directed 有向グラフのサイクル検出 - bfs01 01-BFS - tree_diameter 木の直径 - euler_tour オイラーツアー - build_LCA, get_LCA LCA - build_tree_dist 木の根からの距離 - dfs_temp DFSのためのテンプレート - init_tree_from_parents 親頂点配列でGraph初期化 - init_graph_from_grid グリッド文字列からGraph初期化 */ void solve() { int n; cin >> n; vt A(n), B(n); rep(i, n) cin >> A[i]; rep(i, n) cin >> B[i]; vt ia(n), ib(n); iota(all(ia), 0); iota(all(ib), 0); int cnt = 0, tot = 0; do { do { int win = 0; rep(i, n) { int a = A[ia[i]], b = B[ib[i]]; if (a >= b) win++; } if (win*2 > n) cnt++; tot++; } while (next_permutation(all(ib))); } while (next_permutation(all(ia))); double ans = (double)cnt / tot; print_double(ans); } int main() { IO /* int t; cin >> t; rep(_, t) solve(); */ solve(); return 0; }