#include <iostream>
#include <algorithm>
#define mod 100000000;
#define ll long long
using namespace std;
const int maxn=15;
ll f[2][1<<maxn];
ll grass[maxn];
ll a[maxn];
int n, m;
ll ans;
void pre(int x)
{
for (int i=1; i<=m; i++)
{
grass[x] <<= 1;
grass[x] += a[i];
}
}
int main ()
{
ios::sync_with_stdio(false);
cin >> n >> m;
for (int i=1; i<=n; i++)
{
for (int j=1; j<=m; j++)
cin >> a[j];
pre(i);
}
for (int s=0; s<(1<<m); s++)
{
if ((s&grass[1]) != s) continue;
if (s&s<<1 || s&s>>1) continue;
f[1][s] = 1;
}
for (int i=2; i<=n; i++)
{
for (int s=0; s<(1<<m); s++)
{
if ((s&grass[i]) != s) continue;
if (s&s<<1 || s&s>>1) continue;
for (int k=0; k<(1<<m); k++)
{
if ((k&grass[i-1]) != k) continue;
if (k&k<<1 || k&k>>1) continue;
if (k&s) continue;
f[i%2][s] += f[(i-1)%2][k];
}
}
}
for (int i=0; i<(1<<m); i++)
ans = (ans+f[n%2][i]) % mod;
cout << ans;
return 0;
}
为撒使用滚动数组就不对了捏,上一题炮兵阵地和这个差不多,也是%2,就能过,这个就不行((
求大佬详解