← All problemsSign in

Probability

CodeChefRating 2992Open on judge ↗

ShareChatland is a grid with $N$ rows (numbered $0$ through $N-1$) and $M$ columns (numbered $0$ through $M-1$). There is a prince and a princess in this land; initially, the prince is in cell $(0, 0)$ and the princess is in cell $(N-1, M-1)$. The prince and princess want to meet. The prince has a *visibility radius* $R_1$. In one step, he can move to any cell such that the Manhattan distance bet

HINT LADDERno hints yet
L1 Observation
L2 Technique
L3 Approach
L4 Pseudo-code
🔒
L5 Full solution
L5 unlocks only if you insist twice
solution.cppC++17

CodeSearch Tutor

Hints, not spoilers — it won’t hand over the full solution unless you insist.

voice by Sarvam AI

Sign in to chat with the tutor and save your progress.

Sign in to start