#P11472. Maximize Minimum XOR Sum
Maximize Minimum XOR Sum
Maximize Minimum XOR Sum
You are given two arrays (a_1, a_2, \dots, a_n) and (b_1, b_2, \dots, b_n). You are allowed to perform the following operation any number of times (possibly zero): choose an index (i) ((1\le i\le n)) and set both (a_i) and (b_i) to zero. After performing your operations, let [ A = a_1\oplus a_2\oplus\cdots\oplus a_n,\quad B = b_1\oplus b_2\oplus\cdots\oplus b_n, ] where (\oplus) denotes the bitwise XOR operation. Your goal is to maximize (\min(A, B)).
Note: It is guaranteed that the input sizes are small enough (e.g. (n\leq 20)) so that a solution checking all (2^n) subsets of indices will run in time.
inputFormat
The first line contains a single integer (n) representing the number of elements in each array.\nThe second line contains (n) space‐separated integers (a_1, a_2, \dots, a_n).\nThe third line contains (n) space‐separated integers (b_1, b_2, \dots, b_n).
outputFormat
Output a single integer representing the maximum possible value of (\min(a_1\oplus a_2\oplus\cdots\oplus a_n,; b_1\oplus b_2\oplus\cdots\oplus b_n)) after performing the operations.
sample
2
1 2
3 4
3