Initially I had also struggled with this problem and you’re right that Malvika’s code is really complex for this problem.

Let me give you a big hint which just then boils down to the solution.

The **key** for this problem relies on the fact that if the position of *R2D2* robot is a[i][j] then the position of the other robot *C3PO* is a[j][n-i-1] since whenever R2D2 takes a step to the *right* or *down* then C3PO **has to** take a step *down* or *left* respectively.

Here is the problem on CodeChef for you to practice : https://www.codechef.com/problems/TWINRO

Let me explain further. As usual, DP comes into the play.

Let DP[i][j] denote the **maximum score that the two robots have achieved** if R2D2’s position is i, j. From the above key I told you, now you also know the position of the other robot. Now you just take max(DP[i-1][j], DP[i][j-1]) for reaching the position i, j (as these are only positions from which R2D2 would have come to i, j) and add the current score of of the two robots. Then the final answer awaits for you at DP[n-1][n-1] since that is the final position of R2D2.

That **key hint** will take care of adding C3PO’s scores as well

Hope this helps. Here’s my code : https://www.codechef.com/viewsolution/12432523