Runtime error in chef and frogs

https://www.codechef.com/viewsolution/33388583

Hello, i am getting NZEC in this, not sure why.

well I am not too familiar with python but I guess whats wrong is that you have assigned values to dp[-1] and dp[-2] but not for d[l[-1]] and d[l[-2]] i guess you forgot to do that at line number 9 and 11
and also a side note as the input array is not sorted so check if d1[int(h[0])-1] is greater than or less than d1[int(h[-1])-1] for ex let say if it is 5 8 or 8 5
a input ex can be
5 3 3
0 8 3 12 5
1 2
1 3
2 5

hope it will solve your problem :slight_smile: