← All problemsSign in

Array Modification

CodeChefRating 1624Open on judge ↗

Chef is really interested in the XOR operation. He wants to take a sequence $A_0, A_1, \ldots, A_{N-1}$ and for each $i$ from $0$ to $K-1$ inclusive (in this order, one by one), perform the following operation: - Let's denote $a = A_{i\%N}$ and $b = A_{N-(i\%N)-1}$ before this operation. - Change $A_{i\%N}$ to $a \oplus b$, i.e. $a$ XOR $b$. Since Chef is busy, he asked you to find the final

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