← All problemsSign in

Unlock The Safe

CodeChefRating 1332Open on judge ↗

Chef has a safe with $N$ dials. The $i$-th dial initially shows the digit $A_i$. To unlock the safe, the digit shown on the $i$-th dial should be $B_i$. In order to achieve this, Chef can choose a dial and perform one of the following two moves on it: - UP move: Increases the number on the chosen dial by $1$. If it is $9$ then it becomes $1$. - DOWN move: Decreases the number on the chosen dial

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