Maximaze XOR sum
시간 제한1초메모리 제한512 MB
배열 A와 B에서 각 위치의 원소를 바꿀지 정해 X(A) + X(B)가 최대가 되도록 하고, 최댓값과 바꿀 위치들을 출력한다. X는 배열 전체의 XOR이다.
문제
Let us use 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, .
You are given two integer arrays and of length . Let's denote as the result of calculating bitwise "exclusive or" for all elements of the array: . Simiarly, let's denote .
For each from to , it is allowed to swap elements and . You must find out which elements should be swapped in order for the sum to be maximum possible.
입력
The first line contains an integer --- the size of the arrays (). The next line contains integers --- elements of the array (). The next line contains the array in the same format.
출력
The first line of output must contain the maximum possible sum and an integer --- the number of required swaps. The next line must contain different integers from to --- indices of the elements to be swapped.
힌트
In the example after the swap the arrays are and .
, , .