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

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

Hello Everyone, Can anyone explain me whether comments in a program hinder the speed of the execution of the code? In yesterday's contest one of my solutions gets TLE on system testing,but when I submit the same code now by removing all the comments,it gets accepted.

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

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

Comments definitely don't affect execution in a compiled language like C++. The executable produced by the compiler will be exactly the same. Notice that your AC submissions are extremely close to the time limit, so it's likely that random variations in execution times caused the difference in verdict.

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

I'm pretty curious though, why is your code so slow? I submitted a solution that was pretty much the same thing except I used a map<int, int> instead of map<long long, long long>. Can it really have that much of an effect?