Painter_Problem


i m getting wrong answer in all test cases,please suggest me the bugs.


i have modified your code now you can see it.

how we know that modulus operation is applied on only last step.for this we have to analyse the overflow condition,am i right sir?

as constraints are big so it is good to take modulus at each step so that value will not increase as (a+b)%m=a%m+b%m;