← All problemsSign in

Prefix Suffix And Or

CodeChefRating 2854Open on judge ↗

JJ has an integer $K$. JJ also has an array $A$ of length $N$ where $(0 \le A_i \lt 2^K)$. He can perform the following operations on $A$ any number of times (possibly zero): - Select $i$ and $x$ such that $1 \le i \le N$ and $0 \le x \lt 2^K$ and for each $1 \le j \le i$, set $A_j := A_j \And x$. - Select $i$ and $x$ such that $1 \le i \le N$ and $0 \le x \lt 2^K$ and for each $i \le j \le N$, se

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