HandIeNeeded's blog

By HandIeNeeded, history, 6 years ago, In English

I was solving Problem B of Andrew Stankevich Contest 45.And I got endless TLE on test 2.It took me about an hour to debug but find nothing wrong. So my last hope is to change the cin/cout with scanf/printf in the IO, since this problem need to read and write about 105 doubles. And it got AC. 11925037 11925015. Check it out! WTF is this?

I have read some post on CF discussing the difference about speed of cin/cout and scanf/printf. But how ever in general cases they talk about read integers. But it seems even if I add ios :: sync_with_stdio(0); in my code, cin/cout is much slower than scanf/printf. Why is this? Anyone knows? Thx in advance.

BTW, how can I share my code in gym so everybody can see it? (since gym has the rule U must got accepted first then U can read the others' code. However I remember once I saw a coder share his code in gym, but I don't need to got AC in advance.)

  • Vote: I like it
  • +8
  • Vote: I do not like it

6 years ago, # |
  Vote: I like it 0 Vote: I do not like it

" how can I share my code in gym so everybody can see it?" That is pretty obvious :P. Put it on ideone.com :d