A walk on a grid
CodeChefOpen on judge ↗
Given a n*n grid with every cell in it consisting of number 1,2 or 3. A person standing at cell (a,b) can go to (c,d) only if (c-a)+(d-b)=1 and c>=a and d>=b. The cost of a walk is the product of all the numbers on the cells visited in that walk. Now you have to answer q queries of the form: for each given x, y -> You start at (1,1) and end your walk in the cell (n,n), now you want to know if th
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.
Sign in to chat with the tutor and save your progress.
Sign in to start