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: CodeChef: Practical coding for everyone link to the Question: CodeChef: Practical coding for everyone
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

https://discuss.codechef.com/questions/128678/people-not-accepting-answers-but-saying-only-thanks

1 Like