HIRINGWO NODEJS WA

I wrote my solution after I watched editorial.

Now I know that many things can go wrong and when I get WA first time didn’t really feel anything.

But I started to double-check the answers with accepted solutions (ex. solutions in python)

I checked answers on my local system from K = 2 X = 2, to K = 1000000 X = 1000000
and it was the same answer as the accepted solution.

Anyone is for hunting the bug?

Thank you in advance!
Lukas

Solution: https://www.codechef.com/viewsolution/39810198
IRINGWO

You mixed python with node js at one place. Take K=2 and X=210, your code will give 9007199254740991 (MAX_SAFE_INTEGER). Also you have made logical error in your recursive function for partition.

1 Like

Wow, didn’t expect such a fast response!

Indeed there was an annoying bug in the script. Thank you!
Took me some time but finally, the solution was accepted!

Kind regards,
L

1 Like