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

Manfre TLE8 Python [3] // Problem 1196. History Exam 10 Dec 2018 17:32
Could anyone give a piece of advice if i have a time limit exceeded with binary search?
hammer Re: TLE8 Python [1] // Problem 1196. History Exam 15 May 2019 21:15
Try sys.stdin.readline() instead of input()

It was helpful for me
Rodion Re: TLE8 Python // Problem 1196. History Exam 11 Sep 2020 23:23
memory limit exteeded xD
lilipottter Re: TLE8 Python // Problem 1196. History Exam 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