Board Painting Question Implementation

Hey, Please help in the implementation of the question given HERE IS THE CODE :- https://ide.codingblocks.com/s/410910. Unable to understand why the number of painters are being given and how to use that in the question.

Hey @Sakshi2004 to check whether k painters can finish job in t time can be done greedily such that no painter paints boards whose sum is greater than t, whenever sum exceeds given t value,we assign current board to new painter (if new painter exists or k>0), else we say it is impossible to do job in t time.
example: we have 4 boards : 20 30 10 40, k=2
lets check for t=40
1 painter - 20 (cant do next board as sum exceeds 40!)
2 painter - 30 10 (cant do next board as sum exceeds 40)
now as 1 more board is left,we say job cannot be completed in t=40
similarly for t=50
1 painter = 20,30
2 painter = 10,40
hence it is possible to do it in t=50
Below is the similar implementation of the code


Also in feedback form you are giving me 4/5 so if there’s anything you want me to improve. Please mention that also.

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.