what is your logic for ZCOPractice Problem Ipl?

Problem Link-https://www.codechef.com/ZCOPRAC/problems/ZCO14004

Please explain your approach with code

//