- محدودیت زمان: ۱ ثانیه
- محدودیت حافظه: ۲۵۶ مگابایت
The symbol $\oplus$ represents the bitwise XOR operator for integers. For example: $$9 \oplus 3 = 1001_2 \oplus 11_2 = 1010_2 = 10$$
The \textit{value} of an array such as $a_1, a_2, \dots, a_n$ is defined as: $$a_1 \oplus a_2 \oplus \dots \oplus a_n$$
You are given two arrays of numbers, $a_1, a_2, \dots, a_n$ and $b_1, b_2, \dots, b_n$.
For each $i$ from $1$ to $n$, you can swap the values of $a_i$ and $b_i$. Write a program to perform these swaps in such a way that the sum of the values of both arrays is maximized.
ورودی
The first line of input contains a positive integer $n$, representing the length of the arrays.
$$1 \leq n \leq 10^5$$
The second and third lines each contain $n$ positive integers separated by space, with the second line representing the elements of array $a$ and the third line representing the elements of array $b$.
$$0 \leq a_i, b_i \leq 10^{18}$$
خروجی
Print a single integer, the maximum possible value for the sum of the values of both arrays.
مثالها
ورودی نمونه ۱
3
1 2 3
3 1 2
خروجی نمونه ۱
6
ارسال پاسخ برای این سؤال