CF1994B Fun Game

题目描述

### 题目大意 Vanya 有一个 01 串 $s=s_1s_2\dots s_n$。他可以对 $s$ 进行一系列变换。每次变换中,Vanya 会取两个整数 $l,r\left(1\le l\le r\le n\right)$,然后对所有 $i\in\left[l,r\right]$,将 $s_i$ **同时**替换为 $s_i\oplus s_{i-L+1}$,其中 $\oplus$ 表示按位异或。 Vanya 想知道 $s$ 能否经过一系列变换,得到另一个长度与 $s$ 相同的 01 串 $t$。

输入格式

输入数据的第一行包括一个整数 $q\left(1\le q\le10^4\right)$,表示测试用例的组数。 对于每个测试用例: - 第一行包括一个整数 $n\left(1\le n\le2\times10^5\right)$,表示 $s$ 和 $t$ 的长度。 - 接下来两行分别包括一个长度为 $n$ 的 01 串,分别表示 $s$ 和 $t$。 输入数据保证 $\sum n\le2\times10^5$。

输出格式

对于每个测试用例,输出一行字符串: - 若 $s$ 可以通过一系列变换得到 $t$,输出 `Yes`。 - 若 $s$ 不可以通过一系列变换得到 $t$,输出 `No`。 特别地,输出结果的大小写不会影响判定。例如,`yEs`,`yes`,`Yes` 和 `YES` 均算作有效答案。

说明/提示

In the first test case, Vanya will not be able to change the sequence $ s $ with the only possible action of choosing $ l = r = 1 $ . In the second test case, the sequences $ s $ and $ t $ are already equal. In the third test case, Vanya can act as follows: 1. Choose $ l = 3 $ and $ r = 5 $ , then $ s $ will become $ \mathtt{101101010} $ . 2. Choose $ l = 5 $ and $ r = 6 $ , then $ s $ will become $ \mathtt{101111010} $ . 3. Choose $ l = 7 $ and $ r = 7 $ , then $ s $ will become $ \mathtt{101111110} $ .