Sum of Xors
You are given a grid of size $N\times M$ $(N$ and $M$ are both even$)$, where each cell of the grid has value $0$. Let $R_i$ denote the [bitwise XOR](https://en.wikipedia.org/wiki/Bitwise_operation#XOR) of all elements of the $i^{th}$ row and $C_i$ denote the bitwise XOR of all elements of the $i^{th}$ column. *Ugliness* of a grid is defined as $\displaystyle{\sum_{i=1}^{N} R_i + \sum_{i=1}^{M}
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