fast printing in python

Revision en1, by duckduckMoose, 2020-07-21 15:14:48

Hi everyone. I was doing 203C. I managed to solve (link) the problem in O(n*log n) time (constraints: n<10^6). But I got TLE. I checked from the editorial and my approach was correct. I read some comments in the editorial suggesting not to use print function and use other methods to print, so I used 'sys.stdout.write'. But then also the problem isn't resolved. How can I print faster than sys.stdout.write?

Tags #python 3, #python, stdout, #round 203

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en1 English duckduckMoose 2020-07-21 15:14:48 545 Initial revision (published)