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 1048. Superlong Sums

С++ solve
Posted by DNS 9 Aug 2010 23:45
Used
   scanf and printf becose i have
DNS    1048    C++    Time limit exceeded    4    2.015    8 012 КБ

whith cin and cout

But, when i used  scanf and printf  i have
DNS    1048    C++    Accepted
    0.656    8 036 КБ

Good luck
Re: С++ solve
Posted by tiancaihb 10 Aug 2010 13:34
Try ios::sync_with_stdio(false); and be happy
Re: С++ solve
Posted by Philip Henderson 30 Aug 2010 15:29
Thanks so much!!! Exact same thing for me, and I would have never figured it out :)

I didn't find the "ios::sync_with_stdio(false);" hint to help though... stayed too slow.
Re: С++ solve
Posted by Nick Loginov (USU) 7 Mar 2011 14:58
Thanks!
I got AC, but in 1.968 time using cin and cout. I spend o lot of time for optimization.
Replacement cin to scanf gave 0.359 time in total :)
Re: С++ solve
Posted by Yatsuko Yin 9 Mar 2011 13:03
try to use gets()+strtok()+atoi(), you will get better results ;)
DNS wrote 9 August 2010 23:45
Used
   scanf and printf becose i have
DNS    1048    C++    Time limit exceeded    4    2.015    8 012 КБ

whith cin and cout

But, when i used  scanf and printf  i have
DNS    1048    C++    Accepted
    0.656    8 036 КБ

Good luck
Re: С++ solve
Posted by magzhan 20 Aug 2011 16:46
First time I used ios_base::sync_with_stdio(false) but many times I got TL on test 4, but changing cin and cout to the scanf and printf respectively, I got AC.