← All problemsSign in

Temperature Balance

CodeChefRating 1245Open on judge ↗

There are $N$ chambers of water in a line. Between the $i$-th chamber and the $(i+1)$-th chamber for each $1 \le i < N$, there is a wall blocking heat from moving between the two chambers. The water in the $i$-th chamber has a temperature level of $A_i$. Additionally, it is known in advance that the sum of $A_i$ is $0$. Each second, you lift exactly one wall, letting heat move between two chamber

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