Why getting TLE in CLBRKT in recently concluded coder's legacy contest

I had just taken in the input and outputed -1 for every query input.But still i received TLE on it.Have a look at my code
https://www.codechef.com/viewsolution/35689520
Can you believe it!! :face_with_raised_eyebrow:
Before this I had tried many solutions but i received TLE on each and every submission.Has anyone else faced the same issue?? What is the problem here.I think this contest has been ruined for me because of this issue.

2 Likes

Use โ€œ\nโ€ instead of endl

4 Likes

Many people donโ€™t know the output buffer is flushed every time endl is used whereas โ€œ/nโ€ would fill up the output buffer and flush it only once at the end of the program.Using endl instead of โ€œ/nโ€ can cost you an AC solution :joy:

and for that I defined -

#define endl '\n'

Contest me ricks nhi lene ka :rofl:

:joy: :joy:

here is my solution it might help :slight_smile: https://www.codechef.com/viewsolution/35683814

I asked the setter about this during the contest only and He said we have accepted solutions in almost all languages so the time limit is fine :frowning:
Too fell into the endl trap :expressionless: :expressionless: