https://www.codechef.com/AUG21A/problems/CHARGE

Can anyone explain how to solve this question

There is an official editorial for CHARGE.
My approach was to sort decreasingly by arrival time filling a MinHeap by charging time, if the latter is greater than T_i - T_j update the charging time in PQ by the remaining time.

1 Like

Ohh okay…Thanks a lot!!

1 Like