问题3255--Match

3255: Match

[命题人 : ]
时间限制 : 5.000 sec  内存限制 : 64 MB

题目描述

There is a matrix of size n*n whose elements are either 0 or 1. Now your task is to find out that given a matrix of size m*m whose elements are also 0 or 1 whether it is a sub-matrix of the previous matrix.

输入

There is a matrix of size n*n whose elements are either 0 or 1. Now your task is to find out that given a matrix of size m*m whose elements are also 0 or 1 whether it is a sub-matrix of the previous matrix.

输出

If the second matrix is a sub-matrix of the first one, print “Yes” on a single line. Otherwise print “No”.

样例输入 Copy

4 2
0 0 0 1
0 1 0 1
1 0 1 0
0 0 0 0
1 0
0 0
3 2
0 0 1
0 1 0
1 0 0
0 0
1 1

样例输出 Copy

Yes
No