Loc June18 Problem CHEFCUP

Why i am getting TLE for my solution even though i m only doing mathematical operations.
It would be a great HELP for me if anyone explain me the right approach to solve this ques and most importantly why my code is getting tle. link to my code: https://www.codechef.com/viewsolution/19014645 link to the Question: https://www.codechef.com/LOCJUN18/problems/CHEFCUP/
I am eagerly waiting for the answer…

2 Likes

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

https://www.quora.com/Which-is-faster-endl-or-n

1 Like

Remove those unnecessary cerr as they take time to print things at required log (which you cant view). Also, endl is slow, use \n instead as @raj_13 said.

thank you guys

1 Like