AtCoder Regular Contest 145
E
Adjacent XOR
AtCoder
⌀ 3581
原题
← DF →
翻译中…

Problem Statement

翻译中…

You are given two sequences, each of length $N$, consisting of non-negative integers: $A=(A_1,A_2,\ldots,A_{N})$ and $B=(B_1,B_2,\ldots,B_{N})$.

翻译中…

Determine whether it is possible to make $A$ equal to $B$ by performing the operation below at most $70000$ times. If it is possible, present a specific sequence of operations that achieves it.

翻译中…
  • Choose an integer $K\ (1\le K \le N)$. For every integer $i\ (2\leq i \leq K)$, simultaneously replace the value of $A_i$ with $A_{i-1} \oplus A_i$.
翻译中…

Here, $\oplus$ denotes bitwise $\mathrm{XOR}$.

翻译中…

What is bitwise $\mathrm{XOR}$? The bitwise $\mathrm{XOR}$ of non-negative integers $A$ and $B$, $A\oplus B$, is defined as follows: When $A\oplus B$ is written in base two, the digit in the $2^k$'s place ($k \geq 0$) is $1$ if exactly one of the digits in that place of $A$ and $B$ are $1$, and $0$ otherwise. For example, $3\oplus 5 = 6$ (in base two: $011\oplus 101 = 110$).

翻译中…

Constraints

翻译中…
  • $2 \leq N \leq 1000$
  • $0 \leq A_i, B_i < 2^{60}$
  • All values in input are integers.
翻译中…

Input

翻译中…

Input is given from Standard Input in the following format:

翻译中…

N
A_1 A_2 \ldots A_N
B_1 B_2 \ldots B_N

翻译中…

Output

翻译中…

If it is impossible to make $A$ equal to $B$ in at most $70000$ operations, print No. If it is possible, print a sequence of operations that achieves it in the following format, where $M$ is the number of operations, and $K_i$ is the integer chosen in the $i$-th operation:

翻译中…

Yes
M
K_1 K_2 \ldots K_M

翻译中…

If multiple solutions exist, any of them will be accepted.

翻译中…

样例

Input #1
3
1 2 0
1 2 3
Output #1
Yes
2
2 3
In this output, the sequence $A$ is changed as follows: - Initially: $A=(1, 2, 0)$. - After the $1$-st operation: $A=(1, 3, 0)$. - After the $2$-nd operation: $A=(1, 2, 3)$. After the two operations, $A$ and $B$ are equal, achieving the objective.
Input #2
2
10 100
1 0
Output #2
No
Input #3
2
1152921504606846975 0
1152921504606846975 0
Output #3
Yes
0
题目信息
题号
arc145_e
时间限制
2 s
内存限制
1024 MB

题面与样例版权归 AtCoder 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。