I am getting NZEC runtime error when i run my code in code chef editor in first line of code.
line is following,
T = int(input())
but i don’t get error in my local cmd.
for full code visit CodeChef: Practical coding for everyone
Hi, The recursion limit should be set while using DFS or recursion in general it will give RE.
Added this to your code and got AC:
Added this
import sys
sys.setrecursionlimit(10**6)
Also you have to output answer Modulo 1000000007
1 Like
Thank you so much.
I pass my sample test case but during submission got wrong answer…
Can you help me…??
code is here CodeChef: Practical coding for everyone
Instead of doing Mod at end, do at every step because in between the multiplication result will overflow so we have to use modular arithmetic property:
a = b * c
a%MOD = (b%MOD * c%MOD)%MOD
So instead of doing this alone,
comb % 1000000007
we do this too,
(count * comb)%1000000007
to avoid overflow
thank you so much…