kilimanjaro2's blog

By kilimanjaro2, history, 8 years ago, In English

Hi,

I have written a solution which runs in O(n) with n being 1e6. I am unable to understand why it gives a TLE. Any help would be much appreciated.

Link to question: http://codeforces.me/problemset/problem/265/C

Link to my code: http://hastebin.com/vususidufi.vala

  • Vote: I like it
  • 0
  • Vote: I do not like it

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

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

»
8 years ago, # |
  Vote: I like it +11 Vote: I do not like it

Try changing endl for "\n". endl forces to flush the output buffer.

  • »
    »
    8 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    Thank you so much. I always though it was the other way round.