← All problemsSign in

Prefix Max Xor

CodeChefRating 2277Open on judge ↗

For an array $A$ of length $N$, an index $i$ ($1 \le i \le N$) is called a prefix maxima if and only if: $$ A_i \ge A_j \text{ for every } j \le i $$ We define a function $PMX$ as follows: - Let $P$ be the set of all prefix maximas of $A$. - Then, $\text{PMX}(A) = \bigoplus_{X \in P} A_X$ where $\bigoplus$ denotes the bitwise XOR operation. That is, $PMX(A)$ denotes the bitwise XOR of all th

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