UKROBOT - Editorial

thats nice.

Can you please tell which two of the points in this case will have the same end points. Because as i thought it each time it encounters a blockage, the center where it will end up at changes its position i.e. each time we’ll have a unique end point.

My Solution - Works for constraints upto (40 x 40) in under 104 moves :sunglasses:

Summary - Imagine the given grid in 1st Quadrant of a 2d plane, my method gives you its equivalent in the 3rd quadrant (and its always unique).

for (i = 1; i <= c; i++) {
    ans += string(1, 'R') + string(r, 'U');
    ans += string(r, 'D');
}
ans += string(c, 'L');
for (i = 1; i <= 2 * r; i++) {
    ans += string(1, 'U') + string(c, 'R');
    ans += string(c, 'L');
}
ans += string(2 * r, 'D');

MY code gives 95/100 score (i.e fails at subtask 1 ) . But I am unable to find the mistake in my code for subtask 1.
Can anyone help me out??

https://www.codechef.com/viewsolution/38302062

I am still wondering, whether am I solving algorithmic problems that can be solved using some data structures or solving puzzles which can be solved using maths, observations, loops or almost arrays.

If contests have only algorithmic questions, its sometimes annoying. Sometimes ad-hoc questions are better to test your critical thinking skills.

1 Like

In the editorial video solution why are we traversing left and right for all the rows below the obstacle one.Can’t we just go r+1 steps up and perform left and right traversing on that single row?

We don’t know which row the obstacle is on

Could you please explain this solution!!
Thank you!