July Cook Off CHEFIHG question

I have a doubt regarding this question. It was mentioned that we can choose any non prohibited cell as the starting point. To reach C any of the U,D,L,R should be non prohibited. So, if I just start from any non prohibited cell that lies either U,or D,or L, or R of ‘C’ and then just take it to C using single instruction, why am I getting WA? Pardon me if I understood the question wrong.

Well you are considering some cells one by one and taking each of them to cell ‘C’ while doing this one by one , the other cells might get displaced from the original positions.

No, I am just checking the cells around C. If any of them are not prohibited, then I am printing the corresponding instruction.

Example
5 6

++++++

+.C…+

++.+++

+…+

++++++

In this cell 2 2 is not prohibited. So, I choose my starting city as 2 2 and then just move ‘R’.

where + represents *

C should be reached in traversing path you give by ans
from every’.’
eg 5 6

++++++

+.C…+

++.+++

+…+

++++++
you can reach C by going right ‘R’ from 1,1
L from 1,3

LL from 1,4

U from 2,2

and so on

lets assume your ans is UDLRUDLR
then for every ‘.’
check if traversing along this path ,you travel to ‘C’ atleast once