#include <iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<vector>
using namespace std;
struct P
{
int x,y;
P(){}
P(int x,int y):x(x),y(y){}
P operator - (const P &t)
{
return P(x-t.x,y-t.y);
}
P operator + (const P &t)
{
return P(x+t.x,y+t.y);
}
};
int k,n,m,w[25],h[25];
char s[25][105][105],mp[1050][1050];
vector<P> v[25];
bool isvalid(P p)
{
if(p.x>=0&&p.x<h[k] &&p.y>=0 &&p.y<w[k])
return true;
return false;
}
bool match(int m1,int m2)
{
P p;
int sz;
bool ans=true;
for(int i=0;i<v[m2].size();i++)
{
ans=true;
for(int j=0;j<v[m1].size();j++)
{
p=v[m1][j]-v[m1][0]+v[m2][i];
if(!isvalid(p))
{
ans=false;
break;
}
if(mp[p.x][p.y]=='#')
continue;
else
{
ans=false;
break;
}
}
if(ans)
return true;
}
return false;
}
int main()
{
scanf("%d",&k);
for(int i=0;i<k;i++)
{
scanf("%d%d",&h[i],&w[i]);
for(int j=0;j<h[i];j++)
{
scanf("%s",s[i][j]);
for(int c=0;c<w[i];c++)
{
if(s[i][j][c]=='#')
v[i].push_back(P(j,c));
}
}
}
scanf("%d%d",&h[k],&w[k]);
for(int j=0;j<h[k];j++)
{
scanf("%s",mp[j]);
for(int c=0;c<w[k];c++)
{
if(mp[j][c]=='#')
v[k].push_back(P(j,c));
}
}
for(int i=0;i<k;i++)
{
if(match(i,k))
printf("Yes\n");
else
printf("No\n");
}
return 0;
}
這一題本來是個枚舉水題,但是微軟似乎有些不尊重人類,只要在大圖裏面找到小圖裏面有星星的對應關係就OK了,完全不尊重常識,剛開始我以爲,必須要在大圖裏找到一模一樣的小圖,其實只要星星的對應關係符合就行了。