#include #include #include using namespace atcoder; using mint = modint998244353; using namespace std; #define rep(i,n) for (int i = 0; i < (n); ++i) #define Inf 1000000001 int N; vector A,R; vector get(int n){ vector dp(N+1,0.0); dp[0] = 1.0; vector ret(N,0.0); rep(i,N){ vector ndp(N+1,0.0); rep(j,N+1){ if(A[i]<=n){ if(i!=N){ ndp[j+1] += dp[j]; } } else{ ndp[j] += dp[j]; } } swap(dp,ndp); ndp.assign(N+1,0.0); rep(j,N+1){ if(j==0)continue; ret[i] += dp[j]/2.0; } rep(j,N+1){ if(j==0){ ndp[j] += dp[j]; } else{ ndp[j] += dp[j]/2.0; ndp[j-1] += dp[j]/2.0; } } swap(dp,ndp); } return ret; } int main(){ cin>>N; A.resize(N),R.resize(N); rep(i,N)cin>>A[i]; rep(i,N)cin>>R[i]; vector t = A; t.push_back(0); sort(t.begin(),t.end()); t.erase(unique(t.begin(),t.end()),t.end()); vector x = get(t[0]); double ans = 0.0; for(int i=1;i y = get(t[i]); /* cout<