QOJ.ac

QOJ

Time Limit: 2 s Memory Limit: 2048 MB Total points: 100

#14332. Corrupted File

الإحصائيات

WannaLaugh 恶意软件是一种正在互联网上传播的新型计算机恶意软件。如果一台计算机感染了该恶意软件,它将损坏计算机中的所有文件。计算机中的文件包含零个或多个位。恶意软件通过执行零次或多次操作来损坏文件。在一次操作中,恶意软件随机选择两个相邻的位,并将它们替换为一个位。如果被替换的两个位均为 1,则新位为 1,否则为 0。

例如,恶意软件可能会按如下方式损坏位序列为 11011011 的文件:

  1. 恶意软件选择第 1 位和第 2 位:11011011 → 1011011。
  2. 恶意软件选择第 2 位和第 3 位:1011011 → 101011。
  3. 恶意软件选择第 3 位和第 4 位:101011 → 10011。

或者,恶意软件也可能先选择第 3 位和第 4 位:11011011 → 1101011。

一天开始时,你有一个包含 $n$ 个位的序列,记为 $B$。你花了一整天时间上网,包括查看你最喜欢的编程竞赛网站,就像许多 ICPC 参赛者所做的那样。一天结束时,同一个文件包含 $m$ 个位,记为 $C$。你需要确定该文件是否可能是由 WannaLaugh 恶意软件损坏的,或者它是否一定是因为其他原因而改变的。

输入格式

输入的第一行包含一个整数 $t$ ($1 \le t \le 10\,000$),表示测试用例的数量。接下来是 $t$ 个测试用例。每个测试用例的格式如下:

第一行包含两个整数 $n$ 和 $m$ ($1 \le m \le n \le 100\,000$)。第二行包含一个长度为 $n$ 的字符串,每个字符为 0 或 1,表示位序列 $B$。第三行包含一个长度为 $m$ 的字符串,每个字符为 0 或 1,表示位序列 $C$。

单个输入文件中所有测试用例的 $n$ 之和不超过 $100\,000$。

输出格式

对于每个测试用例,如果位序列 $B$ 可能被 WannaLaugh 恶意软件损坏为位序列 $C$,则输出 yes,否则输出 no。

样例

输入 1

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

输出 1

yes
yes
no

说明

第一个测试用例对应于题目描述中的示例。

对于第二个测试用例,恶意软件可能执行了零次操作。

对于第三个测试用例,恶意软件不可能将位序列 101 损坏为 00。

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.