← All problemsSign in

Saber Slays

CodeChefRating 2778Open on judge ↗

There are $N$ dungeons in a row. The $i^{th}$ dungeon is guarded by a monster with strength $S_i$. Saber has a sword with $D$ damage points. To defeat a monster of strength $S_i$, Saber's sword must have **at least** $S_i$ damage points: - If $D\lt S_i$, Saber loses the fight. - If $D = S_i$, Saber defeats the monster but has a close call and her sword loses **exactly one** damage point $(D:=D

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