← All problemsSign in

Water Sort Puzzle (Challenge)

CodeChefRating 3758Open on judge ↗

Chef wants to study reactions between non-miscible reagent samples with different colours. There are $N$ colours (numbered $1$ through $N$). Chef has $N+2$ test tubes (numbered $1$ through $N+2$), each of them can hold a volume $M$ ml; initially, tubes $N+1$ and $N+2$ are empty, while for each $i$ ($1 \le i \le N$), the $i$-th tube is completely filled and contains $M$ ml of reagents with some col

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