← All problemsSign in

Grid Path Construction

CSESConstruction ProblemsOpen on judge ↗

Given an n \times m grid and two squares a=(y_1,x_1) and b=(y_2,x_2), create a path from a to b that visits each square exactly once. For example, here is a path from a=(1,3) to b=(3,6) in a 4 \times 7 grid: Input The first input line has an integer t: the number of tests. After this, there are t lines that describe the tests. Each line has six integers n, m, y_1, x_1, y_2 and x_2. In all tes

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