← All problemsSign in

Princess and Dragons

CodeChefRating 2879Open on judge ↗

There are $N$ dragons in Wonderland (numbered $1$ through $N$). Each dragon lives in one of $N$ caves, which are located in a single row and numbered $1$ through $N$ in the order from left to right. Let's denote the strength of the $i$-th dragon by $S_i$. Also, a beautiful princess lives in Wonderland. Many princes would like to marry her. But the princess feels self-sufficient, so she doesn't wa

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