https://www.codechef.com/ZCOPRAC/problems/ZCO14003

https://www.codechef.com/ZCOPRAC/problems/ZCO14003

plz explain the question

The problem asks you to find the total maximum revenue you can generate by selling the phone at some price X. Any person whose total budget is less than this X will not be able to buy. You will have to change X accordingly

You have N customers. Each of them has a specific budget for an app that you are developing. They will purchase your app at the selling price if and only if the selling price of your app is less than or equal to their budget.
Now, you want to set a selling price for your app in such a way that, the revenue you earn from the purchases is maximum.

Explanation of sample input

N=4
Their budgets : \{30, 20, 53, 14\}

If you set selling price more than 53, no one will buy your app (as 53 exceeds their budget’s) and you will get 0 revenue. If you sell it at 53, only the person with budget 53 will buy, giving you revenue 53.

Note that, If you sell it at price 52, the person with budget 53 will buy, but he will buy it for 52 units. Thus, you only get 52 revenue.
This goes on till revenue 30. When you sell it at 30, two people are willing to buy : person with budget 53 and person with budget 30. Thus, when both of them buy your product (each of them buy it for 30 units), the overall revenue you earn is 60.

You can manually check and determine that there exists no higher revenue that you can earn!

1 Like

thank bro for a cool explanation

1 Like

btw have you participated in zco 2020

can you add me in your team for icpc 2019

zco 2020 has not yet been conducted. It will be conducted on the first of December. Registrations are open.