← All problemsSign in

Village Road Network

CodeChefRating 3113Open on judge ↗

In the nation of Chefland there are villages at co-ordinates $(x,y)$ whenever $x$ and $y$ are non-zero odd co-prime integers. $x$ can be either positive or negative, but $y$ is always positive. In each village $(x,y)$ there is a crossroads, with the roads marked North, South, East, West. Road East leads to $(x+2y, y)$. Road West leads to $(x-2y, y)$. Road North leads to either $(x, y+2

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