Please help me with the following question
you didn’t read ques correctly. re-read it. it says that he can’t break bricks if the sum of widths exceeds his strength, he can either rotate or break single.
Come on dude.
Seems you are just starting cp.
And it’s an easy problem.
So find your mistakes yourself and restrain from posting these spoon feeding requests for easy problems like this in the very beginning of your career.
If you are unable to find the mistake, take help of the editorial or see other’s solutions and try to find what you’ve missed out and then solve.