prabhav3257's blog

By prabhav3257, history, 2 months ago, In English

I was solving a problem on codechef called Doof fires Brackets (Problem Code: CLBRKT) https://www.codechef.com/problems/CLBRKT

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

and this is my solution after numerous attempts i am still getting a TLE please help me solve this problem

 
 
 
 
  • Vote: I like it
  • 0
  • Vote: I do not like it

»
2 months ago, # |
Rev. 6   Vote: I like it +3 Vote: I do not like it

Check if replacing the endl output stream manipulator with '\n' resolves the TLE issue. In general, the endl manipulator makes an implicit os.flush() function call after making a os.put('\n') function call to print '\n', which slows down the program run-time. You should use endl only in interactive problems, where you would like to make sure that no characters are still pending in the output stream buffer before reading the next data item from the input stream.

std::endl