XOR Sum
WARNING: This problem has large input / output files. Use of faster I/O methods is recommended. Chef has a sequence of N positive integers { a1, a2, a3, ... aN }. The Sous Chef wants to choose another sequence of N non-negative integers { b1, b2, b3, ... bN } such that - The bitwise xor sum of these 2 sequences is equal - i.e, a1 ^ a2 ^ a3 ^ ... aN = b1 ^ b2 ^ b3 ^ ... bN - for each i, bi ≤ ai
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.
Sign in to chat with the tutor and save your progress.
Sign in to start