Problem with INOI 2019 Problem 1 : Processor Scheduling

So I’m having a problem solving the 1st DP problem of INOI 2019 : Processor Scheduling
Even after implementing an Iterative DP approach for the problem , it gives TLE. I know I’m missing out on some silly bug. Can anyone help me out ?

Problem Link : https://www.codechef.com/INOIPRAC/problems/INOI1901
Code Link : https://ideone.com/CQulix

Thanks in advance