← All problemsSign in

5 - Minimum Cost Direction

Okabe wants to visit all of the $N$ distinct points $(x_{i},y_{i})$, $1 \leq i \leq N$ in the $2D$ plane. To do this he has to pick two vectors (or directions) $A$ and $B$ such that $A$ and $B$ are perpendicular. He can move along $A$ and $-A$ for a cost of $1$ per unit distance and move along $B$ and $-B$ for no cost at all (He can move real units too in these directions). He cannot move in any

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