#include #include using namespace std; int main(){ int all = 0,win = 0,n; cin >> n; int a[n],b[n],numa[n]; for(int i = 0;i < n;i++){ cin >> a[i]; numa[i] = i; } for(int i = 0;i < n;i++) cin >> b[i]; do{ int count = 0; for(int i = 0;i < n;i++) count += (a[numa[i]] > b[i] ? 1 : -1); if(count > 0) win++; all++; }while(next_permutation(numa,numa + n)); cout << double(win) / all << endl; }