I didn't quite understand the editorial. I hope you guys, will help me clear my doubts.
First doubt is:
the first stament in editorial reads:
The main idea of the task is that the answer is minimal x which satisfies the condition that the number of dishes with cost ≥x is strictly more than the number of pupils who have more than x togrogs.
But if we have dishes cost as 6,8,2,4 ; and pupils togrogs as 3,3,6,1,10,4
then according to this ans is 4
but in reality ans should be -1.