90pts
用了状压+递归,不会优化
#include<bits/stdc++.h>
using namespace std;
const int P=1e8;
int n,m;
int gs[13],now[13];
int sum(int p){
if(p>n){
return 1;
}
int s=0;
for(now[p]=0;now[p]<(1<<m);now[p]++){
if(gs[p]&now[p]){
continue;
}
if(now[p]&now[p-1]){
continue;
}
if(now[p]&(now[p]<<1)){
continue;
}
s=(s+sum(p+1))%P;
}
return s;
}
int main(){
scanf("%i%i",&n,&m);
int x;
for(int i=1;i<=n;i++){
for(int j=0;j<m;j++){
scanf("%i",&x);
gs[i]=(gs[i]<<1)+!x;
}
}
printf("%i",sum(1));
}