Hello everyone. This is a question of the ongoing January Cook-Off 2019. I do not need any hints for the answer, I just need some clarification for the question. I have asked the relevant doubts in the comments of the question, here’s the link for the comments:
Here’s the link for the question:
Can someone please explain with an example as to what I exactly need to do? Help appreciated, thanks a lot!
The comment by the author has basically explained everything that you need to know.
Look at the sample test and figure out the rest for yourself.
Any more hints cannot be given as the contest is still on.
The question is how many fields can be reached.
So, it does not make a difference if the king can not-move, since it does not make a difference in the count of fields that can be reached.
See, what the question basically meant was to find out the number of distinct cells where the king can be positioned when you have atmost k moves. So in the first move the king can move to all its adjacent cells (which makes a total of 9 including the initial cell). Then considering the same way, it can move to other cells too.
Have a look at my solution to understand it more clearly. https://www.codechef.com/viewsolution/22562603