Help needed in HORSES and CNOTE

hii i am new to CP so could you please help me with the following problems

https://www.codechef.com/problems/HORSES
here is my solution
https://www.codechef.com/viewsolution/45483354

https://www.codechef.com/problems/CNOTE
here is my solution
https://www.codechef.com/viewsolution/45482217

if run it with the inputs given in the example then to output is correct in both cases but when i submit it it shows wrong answer
i have looked at the code 2-3 times but cant find the problems

if you find any problems please let me know

and also if there is a discord or some other place where the community is active please let me know

Consider the test input:

1
26 19 83 3
53 1
83 1
43 1

Stop smothering exceptions (i.e. remove all the try ... pass stuff) and this will give you a hint.

Further hint: consider the test input where there are 5000 horses and their skills are the numbers 1 to 5000 in order.

if i remove ‘try and except’ it gives me runtime error NZEC
when i first got the error i couldn’t resolve it as i didn’t know what it was so i googled it and someone told me to use try and except…

If you get a runtime error, the correct thing to do is fix it - hiding it just makes it into a less-specific WA!

so how do i find where the error is
i tried the input which you gave me in CNOTE and it gave me a NZEC but when i put other inputs it doesn’t show any error …

and excuse me if asking a really dumb question cause i m quite new to python…

You’ve got a 100% reproducible testcase - get debugging :slight_smile:

i meant if i run into such error in future how can know what input do i need to take to get the error
basically i wanted to know how did you come up with that input which gave me the error

Oh, I wrote an automated testcase generator for CNOTE (ages ago) and used that to compile a list of random testcases and their results.

nvm i got what the problem was…
and thanks a lot for helping…

btw is there any place other than this where the CP community is active ??

1 Like

Dunno - I only do Codechef, and then I only help out on these forums :man_shrugging:

oohk…

thanks a lot :wave:

1 Like