| Codeforces Round 1114 (Div. 3) |
|---|
| Finished |
This is the easy version of the problem. In this version, you are only asked to determine whether string $$$a$$$ can be transformed into string $$$b$$$.
Yousef has given you two binary strings, $$$a$$$ and $$$b$$$, of the same length $$$n$$$.
You are allowed to perform any of the following operations:
Your task is to determine whether it is possible to transform string $$$a$$$ into string $$$b$$$ using a finite number of operations.
$$$^{\text{∗}}$$$A string $$$a$$$ is a substring of a string $$$b$$$ if $$$a$$$ can be obtained from $$$b$$$ by deletion of several (possibly zero or all) characters from the beginning and several (possibly zero or all) characters from the end.
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases.
The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the length of each string.
The second line of each test case contains a binary string $$$a$$$ ($$$|a| = n$$$), consisting of only characters $$$\texttt{0}$$$ and/or $$$\texttt{1}$$$.
The third line of each test case contains a binary string $$$b$$$ ($$$|b| = n$$$), consisting of only characters $$$\texttt{0}$$$ and/or $$$\texttt{1}$$$.
It is guaranteed that the sum of $$$n$$$ over all test cases does not exceed $$$2 \cdot 10^5$$$.
For each test case, output "YES" if the string $$$a$$$ can be transformed into string $$$b$$$ using a finite number of operations, and "NO" otherwise.
You can output the answer in any case (upper or lower). For example, the strings "yEs", "yes", "Yes", and "YES" will be recognized as positive responses.
91002011030011004101001014110010005010011001061100000000116111000000111710011000000111
YESNOYESNONOYESYESNOYES
In the first test case, it already holds that $$$a = b$$$. Therefore, the answer is YES.
In the second test case, we cannot perform any operation. Since $$$a \neq b$$$, the answer is NO.
In the third test case, we can choose the substring $$$a[1, 3] = \texttt{001}$$$ and replace it with $$$\texttt{100}$$$, making $$$a = b$$$. Therefore, the answer is YES.
In the seventh test case, we can do the following in order:
Therefore, the answer is YES.
| Name |
|---|


