-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path3-ans.cpp
More file actions
54 lines (52 loc) · 1.16 KB
/
3-ans.cpp
File metadata and controls
54 lines (52 loc) · 1.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#include <bits/stdc++.h>
#define rep(i, a, b) for (int (i) = (a); (i) <= (b); ++(i))
#define fep(i, a, b) for (int (i) = (a); (i) < (b); ++(i))
#define N 37
using namespace std;
string s;
int ans[N][N];
int ha, wa, hb, wb, hc, wc;
int a[N][N], b[N][N], c[N][N];
int main() {
scanf("%d%d", &ha, &wa);
for(int i=1;i<=ha;i++) {
cin >> s;
for(int j=0;j<s.size();j++)
a[i][j + 1] = (s[j] == '#');
}
scanf("%d%d", &hb, &wb);
for(int i=1;i<=hb;i++) {
cin >> s;
for(int j=0;j<s.size();j++)
b[i][j + 1] = (s[j] == '#');
}
scanf("%d%d", &hc, &wc);
for(int i=1;i<=hc;i++) {
cin >> s;
for(int j=0;j<s.size();j++)
c[10 + i][11 + j] = (s[j] == '#');
}
for(int i=1;i<=hc+10;i++)
for(int j=1;j<=wc+10;j++)
for(int k=1;k<=hc+10;k++)
for(int l=1;l<=wc+10;l++) {
memset(ans, 0, sizeof ans);
rep(p, 1, ha)
rep(q, 1, wa)
if (a[p][q])
ans[i + p - 1][j + q - 1] = 1;
rep(p, 1, hb)
rep(q, 1, wb)
if (b[p][q])
ans[k + p - 1][l + q - 1] = 1;
int f = 1;
rep(p, 1, 30)
rep(q, 1, 30)
if (ans[p][q] != c[p][q])
f = 0;
if (f)
return puts("Yes"), 0;
}
puts("No");
return 0;
}