#ARC145E. [ARC145E] Adjacent XOR

[ARC145E] Adjacent XOR

Score : 800800 points

Problem Statement

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

Determine whether it is possible to make AA equal to BB by performing the operation below at most 7000070000 times. If it is possible, present a specific sequence of operations that achieves it.

  • Choose an integer K (1KN)K\ (1\le K \le N). For every integer i (2iK)i\ (2\leq i \leq K), simultaneously replace the value of AiA_i with Ai1AiA_{i-1} \oplus A_i.

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

What is bitwise $\mathrm{XOR}$?

The bitwise XOR\mathrm{XOR} of non-negative integers AA and BB, ABA\oplus B, is defined as follows:

  • When ABA\oplus B is written in base two, the digit in the 2k2^k's place (k0k \geq 0) is 11 if exactly one of the digits in that place of AA and BB are 11, and 00 otherwise.

For example, 35=63\oplus 5 = 6 (in base two: 011101=110011\oplus 101 = 110).

Constraints

  • 2N10002 \leq N \leq 1000
  • 0Ai,Bi<2600 \leq A_i, B_i < 2^{60}
  • All values in input are integers.

Input

Input is given from Standard Input in the following format:

NN

A1A_1 A2A_2 \ldots ANA_N

B1B_1 B2B_2 \ldots BNB_N

Output

If it is impossible to make AA equal to BB in at most 7000070000 operations, print No. If it is possible, print a sequence of operations that achieves it in the following format, where MM is the number of operations, and KiK_i is the integer chosen in the ii-th operation:

Yes

MM

K1K_1 K2K_2 \ldots KMK_M

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

3
1 2 0
1 2 3
Yes
2
2 3

In this output, the sequence AA is changed as follows:

  • Initially: A=(1,2,0)A=(1, 2, 0).
  • After the 11-st operation: A=(1,3,0)A=(1, 3, 0).
  • After the 22-nd operation: A=(1,2,3)A=(1, 2, 3).

After the two operations, AA and BB are equal, achieving the objective.

2
10 100
1 0
No
2
1152921504606846975 0
1152921504606846975 0
Yes
0