Пожалуйста, прочтите новое правило об ограничении использования AI-инструментов. ×

Блог пользователя taap_cader

Автор taap_cader, история, 3 года назад, По-английски

Sometimes when I do question of around 10^7 operations, I don't need to use fast io but the questions which can be solved with 10^5 operations gets TLE without using fast io. Is there some trick to guess when do we need to use fast io or it we have to use it in every question.

  • Проголосовать: нравится
  • -17
  • Проголосовать: не нравится

»
3 года назад, # |
  Проголосовать: нравится +19 Проголосовать: не нравится

Use it always anyway.

»
3 года назад, # |
  Проголосовать: нравится +3 Проголосовать: не нравится

Use it always!!

»
3 года назад, # |
Rev. 3   Проголосовать: нравится +9 Проголосовать: не нравится

What do you mean by "fast io"?

If you mean some customized input implemented with getchar, it's almost never needed. I've never seen a problem on Codeforces needing this.

If you mean scanf vs cin, my suggestion is to always use scanf. On online judges running on Linux, cin with ios::sync_with_stdio(false) and cin.tie(0) is slightly faster (it's not a typo) than scanf. But Codeforces is on Windows so I'm not sure, and scanf is almost always fast enough.

If you mean other languages (than C++), I can't give any advice since I don't know.

  • »
    »
    3 года назад, # ^ |
      Проголосовать: нравится +15 Проголосовать: не нравится

    I just take a look at the OP's submissions. I think he/she gets TLE on large number of operations because he/she used endl everywhere.

    Don't use it — it does not give any advantage in competitive programming, but just slows down the output. Use plain '\n'.

    I'm very annoyed by the fact that many C++ teachers implies to the student to use endl, without even telling what it is.