← All problemsSign in

Nikitosh and xor

CodeChefRating 2160Open on judge ↗

Nikitosh the painter has a 1-indexed array A of N elements. He wants to find the maximum value of expression (A[l1] ⊕ A[l1 + 1] ⊕ ... ⊕ A[r1]) + (A[l2] ⊕ A[l2 + 1] ⊕ ... ⊕ A[r2]) where 1 ≤ l1 ≤ r1 l2 ≤ r2 ≤ N. Here, x ⊕ y means the bitwise XOR of x and y. Because Nikitosh is a painter and not a mathematician, you need to help him in this task. Input The first line contains one integer N, deno

HINT LADDERno hints yet
L1 Observation
L2 Technique
L3 Approach
L4 Pseudo-code
🔒
L5 Full solution
L5 unlocks only if you insist twice
solution.cppC++17

CodeSearch Tutor

Hints, not spoilers — it won’t hand over the full solution unless you insist.

voice by Sarvam AI

Sign in to chat with the tutor and save your progress.

Sign in to start