Company: Stanley shl on campus_13april
Difficulty: medium
The current selected programming language is C++14 . We emphasize the submission of a fully working code over partially correct but efficient code. Once submitted, you cannot review this problem again. You can use cout to debug your code. The cout may not work in case of syntax/runtime error. The version of GCC being used is C++14 (GCC 5.4) . A production company wishes to calculate the Television Rating Point (TRP rating) of their channel. To do so, they gather the TRP ratings of the N movies that are streamed in a day. The TRP rating of the channel is calculated by maximising the sum of the ratings selected by the company's algorithm from the N selected movie rating list. The company has designed a special algorithm that performs the calculation by first selecting a random rating R from the rating list, then marking it for the TRP calculation and removing it from the list. After that all occurrences of the next-greater and next-smaller ratings than the selected rating are removed fro