july challange

hii
can anyone help me with my solutuion i cant understand why my solution didnt pass the time limit…
thanks…

link to my solution

https://www.codechef.com/viewsolution/14490817

I didn’t quite understand the program but I can give you the solution to it.
What you can do is save a triplet of of the days,lecture and sadness and then sort it according to the days of arrival. Then you can make a loop which ends when the total days are over or the no. of lecturers remaining is 0. In the loop add all the lecturers sadness and no. of lectures which have arrived on that particular day of the loop in a max heap . Further in the loop remove the max element according to their sadness from the max heap . Check if the lectures remaining are greater than 1 if so push the element back into heap with no. of elements one less than previous count of lectures .
This will be done until lecturers are remaining or days are remaining . Count the relieved sadness from the total sadness .