I was doing this question in yesterday’s lunchtime . The complexity of my solution matches with that of AC solutions . Still I can’t figure out the reason for getting TLE on the last subtask . Any help would be appreciated .
Here is the link to my solution .
Thanks in advance .