CakeWalk- Runtime ERROR

problem link:
https://www.codechef.com/problems/CKWLK

solution link:
https://www.codechef.com/viewsolution/27509071

Why I am getting runtime error (NZEC)?

Firstly, you have to print Yes and No instead of YES and NO and
for the input:

$ python prog.py
1
4

You are trying to touch parts of list a, that you are not supposed to

Traceback (most recent call last):
  File "prog.py", line 20, in <module>
    primefactors(n,a)
  File "prog.py", line 6, in primefactors
    a[2]+=1
IndexError: list index out of range

You might want to go through the editorial. It can be solved in a simpler way. :slightly_smiling_face:

1 Like