I am getting right answer for sample test cases.
But still on submission its failing the test cases?
Can you check what's wrong in my code?
don’t multiply the time with a[i]
consider time at end only
i have done some changes
if you have any doubt fell free to ask
Modified Code
Return minimum time required to paint all boards % 10000003.
Return minimum time required to paint all boards % 10000003. What does this statement given in question mean here?
yes
i have taken mod with variable mod
which is define above
#define mod 10000003
return (ans%mod * t%mod)%mod; In this statement in your code you took mod for each variable, can’t we take it directly for the whole ans? Also why in the question, have they asked to take the mod? And our ans also does’t change after taking the mod, how come?
we have done so because
a*b can overflow the range so we take mod before multiplying
it is the property of mod
(a*b)%c= (a%c *b%c)%c;