1 / 6
Jul 2012

My code runs fine on my machine and on ideone. However, on spoj, i get runtime error (NZEC). Can someone please take a look and let me know what the issue is?
code at:
ideone.com/OGyCa

Thanks

  • created

    Jul '12
  • last reply

    Jul '12
  • 5

    replies

  • 242

    views

  • 3

    users

  • 4

    links

Fiddling around with your code, I ran into NZEC with this input. Are you sure to process input correctly?

Hi,

still I did not not understand your code nor your algo. I recognized that you use some recursion in your checkSequence function - and this can always result in an issue if exposed to real large test cases (e.g. runtime, recursion level, memory). Remember, there are up to 100 000 words allowed per test case.

So I only did some checks with your code, and I generated some larger input with 1200 words. And even on IDEone your code does not finish within 15 secs for this input. It is able to process approx. 675 words, but the runtime increases dramatically for lorger input.

Perhaps this helps to identify the bottleneck...
Regards
Daft

I also don't know what causes the NZEC in your code, but as daft_wullie pointed out before:
Even if your code passes without NZEC, it will time out by far, so instead of searching for the NZEC you should start with a new, transparent and faster approach.

Suggested Topics

Want to read more? Browse other topics in Python or view latest topics.