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 1846. GCD 2010

Avoiding TL
Posted by vlyubin 11 Apr 2012 08:21
I was barely able to pass the TL by using the segment tree. That part probably works OK, but what causes troubles is the way I locate the array index by given content value (i.e. we want do delete 8, so I search for 8's index and replace it with 0). For that purpose I was using map from STL and wasn't able to come up with anything better (except some hash-like storage). What did you use for that purpose or could you avoid such situation at all?

Thanks.
Re: Avoiding TL
Posted by derkenbaev 4 Jul 2017 16:34
I solved by exactly the same algorithm, but got TLE 16-21. Then I just changed my cin to scanf and got AC for 0.218
Re: Avoiding TL
Posted by Mahilewets 4 Jul 2017 17:53
Try ios::sync_with_stdio (false) .
Report was it success or not.
I am interested how useful is ios::sync_with_stdio(false) .
Re: Avoiding TL
Posted by Sergey 6 Aug 2017 06:31
Yes it does help. My solution (sqrt) was TLE 17. after this line it is AC 0.421.
Just put this into main as the first line.
thanks for the suggestion, I was too lazy to use scanf:)
dont forget though that if you use this, then you cannot use printf and scanf in the same program with cin