side), (side, 0) and (side, side). Camera spots are marked on its fence: spots[i] = [x, y] is a spot's position. All spots are distinct and lie on the boundary of the square.
Pick exactly cameras spots and mount cameras there so that they are as far apart as possible. The distance between (x₁, y₁) and (x₂, y₂) is |x₁ - x₂| + |y₁ - y₂| (Manhattan distance).
Return the largest possible value of the smallest distance between two chosen cameras.side=3, spots=[[0, 0], [0, 3], [3, 3], [3, 0], [1, 0], [3, 2]], cameras=4 → 3
Put the cameras in the four corners: any two of them are at least 3 apart.
side=2, spots=[[0, 1], [1, 2], [2, 1], [1, 0], [0, 0]], cameras=5 → 1
All five spots get a camera; the closest pair is (0, 1) and (0, 0), at distance 1.
side=4, spots=[[0, 2], [2, 4], [4, 2], [2, 0], [0, 0], [4, 4]], cameras=4 → 4
side ≤ 10⁹len(spots) ≤ min(4 · side, 15,000)spots[i] lies on the boundary of the square, and all spots are distinctcameras ≤ min(25, len(spots))side=3, spots=[[0, 0], [0, 3], [3, 3], [3, 0], [1, 0], [3, 2]], cameras=4
3
Run checks the first 3 tests in your browser. Submit checks all 38 tests on the server, hidden ones included.