-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathP172PROC.cpp
More file actions
60 lines (54 loc) · 1.04 KB
/
P172PROC.cpp
File metadata and controls
60 lines (54 loc) · 1.04 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
55
56
57
58
59
60
#include<bits/stdc++.h>
using namespace std;
#define For(i, a, b) for(int i = a; i <= b; i++)
#define Ford(i, a, b) for(int i = a; i >= b; i--)
#define ll long long
#define here cout<<"I am Here"<<endl;
int const maxn = 1000000;
int const base = 1e9 + 7;
struct No{
string A;
string B;
};
int main(void){
int T;
cin>>T;
while(T--){
int M, N;
int ok = 1, test = 0;
No Ar[1001];
cin>>N>>M;
For(i, 0, N - 1){
cin>>Ar[i].A;
}
int R, C;
cin>>R>>C;
For(i, 0, R - 1) cin>>Ar[i].B;
For(i, 0, N - R){
For(j, 0, M - C){
ok = 1;
int x = 0;
For(k, i, i + R - 1){
int y = 0;
For(l, j, j + C - 1){
if(Ar[k].A[l] != Ar[x].B[y]){
ok = 0;
break;
}
y++;
}
if(ok == 0) break;
x++;
}
if(ok == 1){
cout<<"YES"<<endl;
test = 1;
break;
}
}
if(test == 1) break;
}
if(test == 0) cout<<"NO"<<endl;
}
return 0;
}