All test cases are not passed ,
Whats wrong in this code?
you have done many major mistakes
one is you are multiplying time with a[i]
you have to consider time only at the end
ones you find max no board painted by painters
then at end multiply it with time and take mod
Modified Code
look at this code
and you have any doubts feel free to ask
i hope this helps
if yes show your response with
and don’t forgot to mark doubt as resolved
What happen if if take mod at end (ans*t)%M;
then ans*t will overflow the range
which will lead to wrong ans