#include #include #include #include #include #include #include #include #include #include #include using namespace std; int bit_count(int s){ int ret = 0; while(s>0){ ret++; s -= s&-s; } return ret; } int main(){ int n; double pa,pb; cin >> n >> pa >> pb; vector a(n),b(n); for(int i=0; i> a[i]; } sort(a.begin(), a.end()); for(int i=0; i> b[i]; } sort(b.begin(), b.end()); auto get_prob = [&](double p){ //状態を幅優先探索 O(2^n * n) vector dp_s(1< used(1< in_queue(1< q; q.push((1< 0){ int s = q.front(); q.pop(); if(used[s]) continue; used[s] = true; in_queue[s] = false; for(int i=0; i>i)&1){ double p_; if(bit_count(s) == 1) p_ = 1.0; else if( (1<> dp(n+1, vector(n, 0)); for(int i=0; i<(1<>k)&1){ double p_; if(bit_count(i) == 1) p_ = 1.0; else if( (1<