Appearance - MarisaOJ: Marisa Online Judge

Appearance

Time limit: 1000 ms
Memory limit: 256 MB
Given two matrices $A$ with $n$ rows and $m$ columns and $B$ with $x$ rows and $y$ columns, check whether $B$ appears in $A$. Matrix $B$ is said to appear in $A$ if there exists a submatrix in $A$ that is identical to $B$. ### Input - The first line contains four integers $n, m, x, y$. - The next $n$ lines each contain $m$ integers representing matrix $A$. - The next $x$ lines each contain $y$ integers representing matrix $B$. ### Output - Print `YES` if $B$ appears in $A$, otherwise print `NO`. ### Constraints - $1 \le n, m, x, y \le 10$. - The elements in the matrices are positive integers not exceeding $100$. ### Example Input: ``` 3 4 2 2 1 3 4 2 2 6 8 1 2 3 4 5 4 2 8 1 ``` Output: ``` YES ```