Sample Explanation
In Sample Case #1, there are two possible orders in which you can serve the pancakes. If you serve the pancake with deliciousness level 5 first, only that one is paid for. If you serve the pancake with deliciousness level 1 first, both are paid for.
Sample Case #2 is the image shown in the problem statement. The following are the possible orders (by deliciousness level) in which the pancakes can be served. The underlined pancakes are the ones that customers pay for.
As you can see, there are some orders in which 3 pancakes are paid for, and none in which all 4 are.
In Sample Case #3, all pancakes are paid for regardless of the serving order.
In Sample Case #4, regardless of which pancake you serve first, the two in the middle will never be paid for. The best you can do is serve the pancake with deliciousness 7 before the pancake with deliciousness 1000000.
Limits
Test Set 1 (7 Pts, Visible Verdict)
Test Set 2 (8 Pts, Visible Verdict)
Test Set 3 (10 Pts, Hidden Verdict)