#include "bits/stdc++.h" #include #pragma warning(disable:4996) using namespace std; using ld = long double; template using Table = vector>; ld pers[11][11]; int shys[11][11]; vector>hands; int main() { int R, C; cin >> R >> C; hands.resize(R+1); for (int i = 0; i < hands.size(); ++i){ hands[i].resize(1 << C); } for (int i = 0; i < R; ++i){ for (int j = 0; j < C; ++j){ cin >> pers[i][j]; pers[i][j] /= 100; } } for (int i = 0; i < R; ++i){ for (int j = 0; j < C; ++j){ cin >> shys[i][j]; } } for (int i = 0; i < (1 << C); ++i){ hands[0][i] = 0; } hands[0][0] = 1; ld ans = 0; for (int r = 1; r <= R; ++r){ for (int k = 0; k < (1 << C); ++k){ const bitset<11>prehands(k); for (int l = 0; l < (1 << C); ++l){ if (hands[r - 1][k] < 1e-11)continue; const bitset<11> knows(l); ld percentage = hands[r - 1][k]; bitset<11>ups(0); vectorpoints(C); for (int i = 0; i < C; ++i){ if (prehands[i]){ points[i] ++; } if (knows[i]){ points[i] += 4 - shys[r - 1][i]; percentage *= pers[r - 1][i]; } else{ percentage *= 1-pers[r - 1][i]; } } for (int i = 0; i < C; ++i){ if (points[i] >= 4){ ups[i] = true; if (i != C - 1)points[i + 1] ++; } } for (int i = C-1; i >=0; --i){ if (points[i] >= 4){ ups[i] = true; if (i != 0)points[i - 1]++; } } hands[r][ups.to_ulong()] += percentage; ans += percentage*ups.count(); } } } cout <