pritamjitmanna's blog

By pritamjitmanna, history, 4 years ago, In English

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.

  • Vote: I like it
  • -20
  • Vote: I do not like it

»
4 years ago, # |
  Vote: I like it +3 Vote: I do not like it

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 years ago, # |
  Vote: I like it +8 Vote: I do not like it

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?