Изменения рейтингов за последние раунды временно удалены. Скоро они будут возвращены. ×

Блог пользователя Mr.Whitebird

Автор Mr.Whitebird, история, 2 месяца назад, По-английски

The only difference between the two submissions is using a lambda function vs a global function. Lambda functions made the runtime around 7 times slower.

What do you think this is because?

AC: 255501228

TLE: 255500672

so should we always prefer global functions over lambdas then?

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

»
2 месяца назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Auto comment: topic has been updated by Mr.Whitebird (previous revision, new revision, compare).

»
2 месяца назад, # |
Rev. 2   Проголосовать: нравится 0 Проголосовать: не нравится

My theory is that its because lambda functions are created each time solve() is called: in the worst case they get created 1000 times each and maybe that's the cause of slowdown

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

Why you use endl though? '\n' doesn't flush the output when combining with cin.tie(0) so it runs faster.

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

    well I figured 1000 cases wont matter much so I usually use endl for debug purposes if the output stream wont be too crowded

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

Just removed pragmas from your code. Don't use them if you don't understand when. https://codeforces.com/contest/1862/submission/255506582