← All problemsSign in

Xor Grid

CodeChefRating 3194Open on judge ↗

Recently Chef invented a new structure that he has called Xor Grid. It is an infinitely large grid G filled with numbers based on these three rules: - G[1, c] = 1 for all c ≥ 1 - G[r, 1] = r for all r ≥ 1 - G[r, c] = G[r - 1, c] xor G[r, c - 1] for all r > 1 and c > 1 Now Chef is wondering, what are the xor sums of all the numbers within some specific rectangles of the Xor Grid? Note Xor sum

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