Prisoners and Parity
CodeChefOpen on judge ↗
Britishers built a prison named "Prison of Parity". There are $N$ cells $C_1, C_2, C_3,C_4......C_n$ and each cell $C_i$ contains $A_i $ prisoners for $1\leq i \leq N$. There are also $N$ XOR cells $X_1, X_2, X_3, X_4.....X_n$, and initially the value of cell $X_i$ is equal to $(C_i) ⊕ (C_{i+1}) ⊕ (C_{i+2}) ⊕....(C_n)$. Jailer visits the prison and he is given $Q$ queries, each query contains a
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