Approach: https://youtu.be/AtIhmHEyGrY?t=2194

It is correct for 50 points but TLE for 100 points.

Can anybody tell why is it TLE?

Problem Link: https://www.codechef.com/LTIME85B/problems/SQRSUBMA

My Submission: https://www.codechef.com/viewsolution/34864039

Ideone Link: https://ideone.com/ZtKgZ6

Update: AC Submission 100 Points