#include #include #include #include #include #include #include #include #include #include #include #include using namespace std; #define mind(a,b) (a>b?b:a) #define maxd(a,b) (a>b?a:b) #define absd(x) (x<0?-(x):x) #define pow2(x) ((x)*(x)) #define rep(i,n) for(int i=0; i=0; --i) #define repl(i,s,n) for(int i=s; i<=n; ++i) #define replr(i,s,n) for(int i=n; i>=s; --i) #define repf(i,s,n,j) for(int i=s; i<=n; i+=j) #define repe(e,obj) for(auto e : obj) #define SP << " " << #define COL << " : " << #define COM << ", " << #define ARR << " -> " << #define PNT(STR) cout << STR << endl #define POS(X,Y) "(" << X << ", " << Y << ")" #define DEB(A) " (" << #A << ") " << A #define DEBREP(i,n,val) for(int i=0; i P; //typedef pair P; typedef pair PI; typedef pair IP; typedef pair PP; typedef priority_queue, greater

> pvqueue; #define N 13 #define N2 1<<13 int bit_count(int v) { int cnt = 0; for(;v!=0;v&=v-1) ++cnt; return cnt; } int main() { int r, c; cin >> r >> c; int p[N][N], s[N][N]; double dp[N][N2]; rep(i, r) rep(j, c) cin >> p[i][j]; rep(i, r) rep(j, c) cin >> s[i][j]; rep(i, c+1) rep(j, (1<>j)&1, y = (j>0 ? (T>>(j-1))&1 : 0), z = (T>>(j+1))&1; if(x+y+z >= s[i][j]) { if((T>>j)&1) { res *= (double)p[i][j]/100.0; } else { res *= (double)(100-p[i][j])/100.0; } } else { if((T>>j)&1) { res = 0.0; break; } } } dp[i+1][T] += res; } } rep(T, (1<