← All problemsSign in

Temporary Temperature

CodeChefRating 1516Open on judge ↗

Chef is cooking his finest dish yet. The recipe calls for a series of $N$ steps, where the $i$-th step is recommended to be performed at a temperature of $A_i$. The steps must be performed in order from $1$ to $N$. The further away from the recommended temperature Chef gets, the worse the dish tastes. Suppose Chef performs the $i$-th step at a temperature of $B_i$. The *unsavoriness* of the

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