Chef and the Queue at the Buffet
CodeChefOpen on judge ↗
During a break in the buffet of the scientific lyceum of the Kingdom of Chefland, there was formed a queue of n high school students numbered from 1 to n. Initially, each student i is on position i. Each student i is characterized by two numbers — ai and bi. Dissatisfaction of the person i equals the product of ai by the number of people standing to the left of his position, add the product bi by
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