champion812r's blog

By champion812r, history, 7 years ago, In English

Hi there. I submitted my code and judge gave me Time limit exceeded error, but when i compile and run same code on my PC everything is OK. Can someone help me?

Link to submission: https://mirror.codeforces.com/contest/1256/submission/64333283

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

| Write comment?
»
7 years ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

Hey, you didn't initialize variable k, so it may have a big value. Therefore, you will never enter the while loop So you will never increase i !

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

You are incrementing and then decrementing i,which may result in an infinite loop