Meet over Grid
There are $N$ people standing on an infinite grid. The coordinates of the $i^{th}$ person is given by $(X_i,Y_i)$. In one move, a person can move to any of its adjacent cell. Note that two cells are adjacent if they share an edge. A group of size $M$ can be formed by selecting any $M$ out of the $N$ people. The *cost* of such a group is defined as the **minimum** number of total moves require
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