← All problemsSign in

Mystic Slimes

CodeChefRating 1879Open on judge ↗

There are $N$ mystic slimes arranged in a line, and the power of the $i$-th slime is $A_i$. You need to perform the following operations until only one slime remains: - Choose two adjacent indices $i$, $j$ ($1 \leq i, j \leq |A|$, $|i - j| = 1$), and let the $i$-th slime eat the $j$-th slime. After this operation, the power of the $i$-th slime becomes $\max(0, A_i - A_j)$ (while the $j$-th slime

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