← All problemsSign in

Chef and Patients

CodeChefRating 1742Open on judge ↗

Dr. Chef is treating COVID-19 patients. There is a queue of $N$ patients (numbered from patient $1$ at the front of the queue to patient $N$ at the back) outside his clinic. You, his assistant, found out that for each valid $i$, the $i$-th patient has an *illness level* $A_i$. Chef treats patients based on their health, i.e. a patient with a higher illness level is always treated before any patie

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