Cheating on Queue
Chef went to the store and saw a long queue. There are $N$ people in the queue (numbered $1$ through $N$ from the front of the queue to the back); as it usually happens in such a situation, each person has a certain anger level. Let's denote the anger level of the $i$-th person by $a_i$. Chef wants to finish shopping as fast as possible, so he decided to try jumping the queue instead of just st
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.
Sign in to chat with the tutor and save your progress.
Sign in to start