I had to watch the video to understand the complete description. The fact that I have to watch the video to understand the problem itself is wrong.
Please give an explanation of how the maximum strength can be 13 for the sample Input.
Explanation of how the Sample Output is derived would be much helpful here.
This question discription is not sufficient
4 4 5 20
. . * .
. # . .
* * . .
. # * *
S=20 and k=5;
first row:
20-2-1-2-1+5-1-2=16
second row:
16-2=14 (Now, he cannot move any further)
third row: -1 for changing the row
14-1+5-1+5-1-2-1-2=16
fourth Row:
16-2-1=13
As 13 >=5, Print βYesβ and 13