← All problemsSign in

Binary Trisection

CodeChefRating 2831Open on judge ↗

Chef has a binary string $S$ of length $N$. Chef also has $Q$ queries. Initially Chef has an empty basket. Chef processes all the queries successively. After the $i$-th query: - Chef adds the substring of $S$ consisting of all the positions from $L_i$ to $R_i$ into the basket. - He asks you whether all the binary strings in the basket can be rearranged to form a binary number **divisible** by $3

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