Topic links
Solution
Pressure (dp\) .
\ (f[i][j][k]\) represents the front \ (i\) column, has placed \ (j\) block turf, and the last state is \ (k\) .
At the same time, you can record the location in each column that cannot be placed \ (w[i]\).
Then you can easily transfer ...
The transfer equation looks at the code.
Code
#include <bits/stdc++.h> #define LL long longusing namespace Std;ll f[13][145][10000],n,k;ll Js[10000],m,sum,ans, W[14];int Main () {cin>>n>>m; Sum= (1<<m)-1; for (int i=1;i<=n;i++) for (int j=1;j<=m;j++) {int x; cin>>x; K+=x; w[i]=w[i]*2+x^1; } for (ll i=0;i<=sum;i++) for (ll j=0;j<m;j++) if (i& (1<<j)) js[i]++; for (ll i=0;i<=sum;i++) {if ((i<<1&i)) continue; if ((i&w[1))) continue; F[1][js[i]][i]=1; } for (LL-i=1;i<n;i++) for (LL-j=0;j<=k;j++) for (ll k=0;k<=sum;k++) {if (!f[i][j][k]) continue; for (ll kk=0;kk<=sum;kk++) {if (kk&w[i+1]) continue; if ((K&KK) | | | (KK<<1&KK)) Continue if (j+js[kk]>k) continue; F[I+1][J+JS[KK]][KK]+=F[I][J][K]; }} for (int. j=0;j<=k;j++) for (ll i=0;i<=sum;i++) ans+=f[n][j][i]; Cout<<anS%100000000<<endl;}
[Usaco06nov] Cornfield corn fields (pressure $dp$)