https://codeforces.com/contest/964/problem/B Can someone explain me how should I solve this problem I dont realy understand what should I do.. I aleready read the editorial but stil cant understand.

"Also, each minute Vasya's bank account receives C·k, where k is the amount of received but unread messages.

Vasya's messages are very important to him, and because of that he wants to have all messages read after T minutes." I dont know what that means.

Take a message arriving at the minute i. For every minute that you don't read it, it's cost goes down by b. But since it is unread, c$ gets deposited in your account for that message.

So we can say that if b >= c, then we have to read the message the minute it is received as delaying it any further would effectively drain money from our account.

Else delay reading the message as much as possible, ie, till the last second to get the maximum profit.

Code

Ok thanks. One more question why c — b? Edit: Ohh nvm I understand now. Thanks again!

Let's say you delay a message by one minute. Its cost reduces by b. But since the number of unread messages increases by 1, our balance increases by c. So for every minute stalled, the effective amount deposited is c-b