is ios_base :: sync_with_stdio (0), much slower that printf and scanf?

Revision en1, by tasmeemreza, 2016-04-25 10:50:58

In yesderday's contest, my submission for D got TLE in the 29 th case (17495055) where I used cin/cout with ios_base :: sync_with_stdio (0), which of course took more than 2 seconds to execute. :O

But today I re-submitted that same code, but changed the cin, couts into scanf and printf (17504450), and got AC! The weird part is that scanf/printf code took only 826 ms to execute, which is more than 2 times faster than ios_base :: sync_with_stdio (0)!

I knew ios_base :: sync_with_stdio (0) ensures almost same speed as scanf and printf. My question is that, does scanf/printf actually ensures significantly faster performance than ios_base :: sync_with_stdio (0) ?

Tags fast input, input-output, large inputs

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en1 English tasmeemreza 2016-04-25 10:50:58 856 Initial revision (published)