| 시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
|---|---|---|---|---|---|
| 2 초 | 2048 MB | 1 | 0 | 0 | 0.000% |
Given $n$ non-empty binary strings $s_1, s_2, \ldots, s_n$ and another $m$ non-empty binary strings $t_1, t_2, \ldots, t_m,ドル determine if there exists such a binary string $S$ that:
The first line contains one integer $T$ (1ドル\le T \le 10^5$) denoting the number of test cases. For each test case:
The first line contains two integers $n$ and $m$ (2ドル \le n \le 10^5,ドル 1ドル \le m \le 10^5$).
The following $n$ lines contain non-empty binary strings $s_1, s_2, \ldots, s_n,ドル one per line.
The following $m$ lines contain non-empty binary strings $t_1, t_2, \ldots, t_m,ドル one per line.
For the total sums over all test cases, it is guaranteed $\sum n + \sum m \le 10^5$ and that $\sum |s_i| + \sum |t_i| \le 10^6$.
For each test case, output a line containing a single string: "Yes" (without quotes) if such a binary string $S$ exists, or "No" (without quotes) if not.
2 3 2 100 001 010 1001 000 2 4 100 001 010 1001 000 11
Yes No
For the first case, one possible string is "0100", where $s_1 = $100 and $s_3 = $010 appear in it, but $t_1 = $1001 and $t_2 = $000 don't appear.