Topic: Given a bad point of the map, require the L-type carpet to cover the entire picture, the number of solutions
Plug DP ...
First due to r*c<=100, so min (r,c) <=10
Then the plug status is: 0-No Plug 1-there is a non-turned plug 2-there is a turn plug
Then you have to yy it ....
Cherish life, stay away from memset
#include <cstdio> #include <cstring> #include <iostream> #include <algorithm> #define M 110# Define MOD 20110520using namespace Std;int m,n;char s[m][m];int sta[200200],tot;bool Available (int temp) {int i;for (i=1;i <=n+1;i++) {if ((temp&3) ==3) return false;temp>>=2;} return true;} struct hash_table{struct list{int hash,val; List *next; List (int _,list *__): Hash (_), Val (0), Next (__) {}}*head[200199];int& operator [] (int x) {int pos=x%200199; List *temp;for (Temp=head[pos];temp;temp=temp->next) if (temp->hash==x) return Temp->val;return (head[pos]= New List (X,head[pos])->val;} BOOL Find (int x) {int pos=x%200199; List *temp;for (Temp=head[pos];temp;temp=temp->next) if (temp->hash==x) return True;return false;}} F,g;int Main () {int i,j,k;cin>>m>>n;for (i=1;i<=m;i++) scanf ("%s", s[i]+1), if (m<n) {swap (m,n); Static char temp[m][m];for (i=1;i<=m;i++) for (j=1;j<=n;j++) temp[i][j]=s[j][i];memcpy (s,temp,sizeof s);} For (i=0;i<1<< (n+1) *2;i++) if(Available (i)) sta[++tot]=i;f[0]=1;for (i=1;i<=m;i++) (j=1;j<=n;j++) {memset (&g,0,sizeof g); for (k=1;k <=tot;k++) {int sta=::sta[k];if (!f.find (STA)) continue;if (s[i][j]== ' * ') {if ((sta>> (n-j) *) &15) (g [Sta]+=f[sta])%=mod;} Else{switch ((sta>> (n-j) *) &15) {case 0: (g[sta^ (0<<) ^ (N-J (1<<) *) n-j])]+=f[sta; (%=mod sta^ (0<< (n-j) ^ (4<< (n-j) *)]+=f[sta])%=mod; (g[sta^ (0<<) ^ (N-J (10<<) * *) n-j ])%=mod;break;case 1: (g[sta^ (1<< (n-j) ^ (4<< (n-j) *)]+=f[sta])%=mod; (g[sta^ (1<< (N-J) * *) ^ (2 << (N-J)]+=f[sta])%=mod;break;case 2: (g[sta^ (2<< (n-j) *) ^ (8<< (n-j) *)]+=f[sta])%=mod; (G[sta ^ (2<< (n-j) ^ (0<< (n-j) *)]+=f[sta])%=mod;break;case 4: (g[sta^ (4<< (N-J) * *) ^ (8<< (n-j) * *) ]+=f[sta])%=mod; (g[sta^ (4<< (n-j) ^ (1<< (n-j) *)]+=f[sta])%=mod;break;case 5: (g[sta^ (5<< (N-J) ^ (0<< (n-j)]+=f[sta])%=mod;break;case 8: (g[sta^ (8<<) ^ (N-j (N-j) (]+=f[sta])%=mod; (g[sta^ (8<< (n-j) ^ (2<< (n-j) *)]+=f[sta])%=mod;break;}} memcpy (&f,&g,sizeof f);} memset (&g,0,sizeof g); for (k=1;k<=tot;k++) {int sta=::sta[k];if (!f.find (STA)) continue;if ((sta&3) ==0) g[ Sta>>2]=f[sta];} memcpy (&f,&g,sizeof f);} Cout<<f[0]<<endl;}
Bzoj 2331 SCOI2011 Floor plug DP