Where have I gone wrong with my logic??
Painters problem logic check
@krishnamanohar199 hey krishna there is some mistake in the code
In the valid function
in the if blocks
if(current_board+boards[i]>ans)
inside this blocks you have to again apply a check of if(painters>k) then return false;
in the line 16 return true;
now second thing In the time taken function
before line 24 you have to multiply like
boards[i]=boards[i] X t; here X is sign of multiplication
In the line 36 ans =mid;
In the line 46 which is return line do (ans)%mod
instead of (ans*t)%mod
and rest of the code is fine
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.