giantweekbold's blog

By giantweekbold, 4 years ago, In English

I cannot for the life of me find the reason for which this submission below is getting TLE, could anyone help?

https://codeforces.me/contest/1476/submission/105936603

Any sort of information would be very useful, I have resubmitted since the contest ended, but to no avail.

Initial thoughts such as infinite recursion (whether it's calling itself again, or indexing above n etc.) seem infeasible because of the constraints imposed. Basically, if I am exploring to the right, I will only keep moving right, so it should not call itself again.

I have tested it extensively with different values of n, and always terminates instantly. The fact that Codeforces shows the output from the program makes me suspicious that it is something else. does anyone know the issue?

Thank you kindly.

(p.s. ignore some typos in the brainstorm at the top).

Full text and comments »

  • Vote: I like it
  • +5
  • Vote: I do not like it