Unable to impose condition on bottom up


how to impose the condition on bottom up dp that if i am unable to add the stones of all color then i should return INT_MIN??

why is no one replying on this one??