ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1196. History Exam

TLE8 Python
Posted by Manfre 10 Dec 2018 17:32
Could anyone give a piece of advice if i have a time limit exceeded with binary search?
Re: TLE8 Python
Posted by hammer 15 May 2019 21:15
Try sys.stdin.readline() instead of input()

It was helpful for me
Re: TLE8 Python
Posted by Rodion 11 Sep 2020 23:23
memory limit exteeded xD
Re: TLE8 Python
Posted by lilipottter 12 Sep 2020 05:03
0. use sys.stdin.readline() (but not readlines! to avoid MLE)
1. do not convert strings to integers
2. use standard set, check x in set

using these ideas i got ok in 0.656, but i'm still wonder how to achive 0.093 (as the best one)

UPD: 0.328 can be achived via os.read by parts ~500kb + len(list(filter(...)))

Edited by author 12.09.2020 06:07