The problem statement is: http://www.iarcs.org.in/inoi/2014/zco2014/zco20142a.php Here is my code: My logic is that if we sort the budgets and find the maximum value of ith budget times (ni). (0based index). ni means the number of people having budget greater than or equal to ithbudget.
asked 28 Nov '14, 16:46

Here's my idea on how to find the highest revenue, although I'm not sure if it is correct. I think the best price would be the median of the array. For the odd length arrays, you can use the middle element and calculate the revenue generated. For even length arrays, you can calculate the revenues for both the elements in the middle and use the greater one. answered 28 Nov '14, 17:10

You declare ans as an array of size n and store (ni)*a[i] in ans[i]. Eventually sort the array (ans) and it's last element is the answer. (I used this logic and had scored 100 upon 100 in the ZCO online practice server). Hope it helps! answered 20 Jan '15, 23:06

ooooooooooooooooooooo...i was also hvin the same prob