Logo
(追記) (追記ここまで)

34608번 - Corrupted File 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
2 초 2048 MB15101066.667%

문제

The WannaLaugh malware is a new computer malware that is spreading on the internet. If a computer is infected by this malware, then the malware will corrupt all files in the computer. A file in a computer contains zero or more bits. The malware corrupts a file by performing zero or more operations. In one operation, the malware randomly picks two consecutive bits and replaces them with a single bit. The new bit is 1 if both of the replaced bits are 1, or 0 otherwise.

For example, the malware might corrupt a file with bits 11011011 as follows:

  1. The malware picks the first and second bits: 110110111011011.
  2. The malware picks the second and third bits: 1011011101011.
  3. The malware picks the third and fourth bits: 10101110011.

Alternatively, the malware might first pick the third and fourth bits: 110110111101011.

At the start of the day, you have a file containing $n$ bits, denoted by $B$. You spend the day surfing the internet, including checking on your favorite programming contest website, just like many ICPC contestants would do. At the end of the day, the same file contains $m$ bits, denoted by $C$. You want to determine whether this file could have been corrupted by the WannaLaugh malware, or if it must have changed for other reasons.

입력

The first line of input contains one integer $t$ (1ドル ≤ t ≤ 10,円 000$) representing the number of test cases. After that, $t$ test cases follow. Each of them is presented as follows.

The first line of input contains two integers $n$ and $m$ (1ドル ≤ m ≤ n ≤ 100,円 000$). The second line contains a string with $n$ characters, each is either 0 or 1, representing the bits $B$. The third line contains a string with $m$ characters, each is either 0 or 1, representing the bits $C$.

The sum of $n$ across all test cases in one input file does not exceed 100ドル,円 000$.

출력

For each test case, output yes if the file with bits $B$ could have been corrupted by the WannaLaugh malware into bits $C,ドル or no otherwise.

제한

예제 입력 1

3
8 5
11011011
10011
3 3
101
101
3 2
101
00

예제 출력 1

yes
yes
no

The first test case corresponds to the example from the problem description.

For the second test case, it is possible that the malware performs zero operations.

For the third test case, it is impossible for the malware to corrupt a file with bits 101 so that it has bits 00.

노트

출처

ICPC > Regionals > Asia Pacific > Asia Pacific Championship > The 2025 ICPC Asia Pacific Championship G번

(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /