Editorial for DMOPC '19 Contest 1 P1 - Test Scores


Remember to use this editorial only when stuck, and not to copy-paste code from it. Please be respectful to the problem author and editorialist.
Submitting an official solution before solving the problem yourself is a bannable offence.

Author: little_prince

One approach is to do some math. Suppose Veshy doesn't solve any of the problems. Therefore, his score would be bini. Then, for every problem he solves, Veshy effectively gains ai+bi marks. Therefore, Veshy needs to solve at least ti+biniai+bi problems. If the ceiling of this number is greater than ni then Veshy cannot get ti marks.

Another approach is to do binary search and continually guess the number of problems Veshy needs to answer, m such that mai(nm)bi.

Time Complexity: O(i=1Nlogni)


Comments

There are no comments at the moment.