Chef and Restaurant
CodeChefOpen on judge ↗
A new restaurant has opened in Chef-land. There are $n$ customers, with powers $p_0,p_1,...,p_{n-1}$, who are eager to visit the restaurant. In order to enter the restaurant, the customers have to stand in a queue. At time $t=i$ second $(0 \leq i < n)$, customer with power $p_i$ joins the queue. The currently joining customer enters the queue at a position such that none of the people standing
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