Can not find the error in logic

this is my implementation of painters partition , but cant seem to pass all the test cases

hello @pradyumn25jain
a) use long long in place of int to avoid overflow

b) search space should be.
s= max_element_in_array * time
e=summation * time

c) do checkout outformat , there they are saying to take print ans%mod

did the required changes still wont work

pls send ur updated code . (the code u have shared is not having any modifications)

image
here u were not multiplying with time.

image
here u were using int , but it should be long long

ur updated code link ->

alright thanks , it worked .