Getting NZEC in solving LVADER problem from spoj

I have recently attempted LVADER from spoj, and I am getting NZEC error but I am not able to figure out what is wrong in my code.

My solution can be found here.

@dushyant7917 @sfialok98 @chandubaba @shubhparekh @vijju123 @dushyant7917 @hemant_dhanuka
@rpatni @vivek_1998299 @rohitthapliyal @the_extractor @baz__ @vijju123 @mathecodician @ritwikshanker @kauts_kanu @gkcs

guys please help.

@dushyant7917 @sfialok98 @chandubaba @shubhparekh @vijju123 @dushyant7917 @hemant_dhanuka
@rpatni @vivek_1998299 @rohitthapliyal @the_extractor @baz__ @vijju123 @mathecodician @ritwikshanker @kauts_kanu @gkcs

guys please help.

The reason for the error is because u are trying to make illegal memory access.

see this code gives tle(just to point the mistake):

https://ide.geeksforgeeks.org/VJyZaBZMav

U are actually trying to calculate factorial of numbers >= MAX

1 Like

@vivek_1998299

I have fixed that and now I am getting wrong ans.

https://pastebin.com/RpDp7ZDZ

See the output format of question.

You should write Case x: ans

@vivek_1998299

Thank you so much, SPOJ doesn’t usually asks for output in that fashion so forgot to add that.