#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #define X first #define Y second #define pb push_back #define rep(X,Y) for (int (X) = 0;(X) < (Y);++(X)) #define rrep(X,Y) for (int (X) = (Y-1);(X) >=0;--(X)) #define repe(X,Y) for ((X) = 0;(X) < (Y);++(X)) #define peat(X,Y) for (;(X) < (Y);++(X)) #define all(X) (X).begin(),(X).end() #define rall(X) (X).rbegin(),(X).rend() using namespace std; typedef long long ll; typedef pair pii; typedef pair pll; template using vv=vector>; template ostream& operator<<(ostream &os, const vector &t) { os<<"{"; rep(i,t.size()) {os< ostream& operator<<(ostream &os, const pair &t) { return os<<"("< &v,long double p,vv &re){ int n=v.size(),m; queue que; vector usd(1< prob(1<>i&1){ long double tmp; if(!f){ tmp=prob[st]*(m==1?1:p); f=1; }else{ tmp=prob[st]*(1-p)/(m-1); } prob[st^(1<>n>>pa>>pb; vector a(n),b(n); rep(i,n) cin>>a[i]; rep(i,n) cin>>b[i]; sort(all(a)); sort(all(b)); //a[i]がj番目に使われる確率を求めたかったけど誤差がやばい vv odra(n,vector(n)),odrb(n,vector(n)); findP(a,pa,odra); findP(b,pb,odrb); //cout<