Maximaze XOR sum

아직 제출이 없습니다시간 제한1초메모리 제한512 MB

문제

Let us use \oplus as the symbol for the operation of bitwise "exclusive or" for integers. In C++ and Java it is denoted by the character "\char 94", in Pascal and Python --- by the keyword "xor". For example, 93=1001_211_2=1010_2=109 \oplus 3 = 1001\_2 \oplus 11\_2 = 1010\_2 = 10.

You are given two integer arrays AA and BB of length nn. Let's denote X(A)X(A) as the result of calculating bitwise "exclusive or" for all elements of the array: X(A)=A_1A_2A_nX(A) = A\_1 \oplus A\_2 \oplus \ldots \oplus A\_n. Simiarly, let's denote X(B)=B_1B_2B_nX(B) = B\_1 \oplus B\_2 \oplus \ldots \oplus B\_n.

For each ii from 11 to nn, it is allowed to swap elements A_iA\_i and B_iB\_i. You must find out which elements should be swapped in order for the sum X(A)+X(B)X(A) + X(B) to be maximum possible.

입력

The first line contains an integer nn --- the size of the arrays (1n1051 \le n \le {10}^5). The next line contains nn integers A_iA\_i --- elements of the array AA (0A_i10180 \le A\_i \le {10}^{18}). The next line contains the array BB in the same format.

출력

The first line of output must contain the maximum possible sum X(A)+X(B)X(A) + X(B) and an integer kk --- the number of required swaps. The next line must contain kk different integers from 11 to nn --- indices of the elements to be swapped.

힌트

In the example after the swap the arrays are A=\[2,1]A = \[2, 1] and B=\[1,2]B = \[1, 2].

X(A)=21=10_21_2=11_2=3X(A) = 2 \oplus 1 = 10\_2 \oplus 1\_2 = 11\_2 = 3, X(B)=3X(B) = 3, X(A)+X(B)=6X(A) + X(B) = 6.