← All problemsSign in

Box and Ball System

CodeChefRating 2107Open on judge ↗

Chef Ciel has forgotten the combination to the safe. It's a serious incident, because the safe contains this month's waitstaff salaries. To open the safe, N boxes and N balls are used. The safe has N boxes that numbered from 1 to N uniquely. Each box can contain only one ball. Now, the box i contains one ball that numbered i, and the safe is locked. The only things which Ciel remember for unlock

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