Interesting Couple
Time limit2sMemory limit2048 MB
Given N points in the plane with Manhattan distance, find the smallest p(i, j) among pairs whose distance d(i, j) is no more than p(i, j).
- Level
Medium7 of 10
- Topics
- Geometry, Sorting, Segment tree
- Solved
- No attempts yet
Problem
You are hosting a party with guests (numbered from to ) in a large room. The party room is a 2-dimensional Cartesian space where guest stands at . Each guest may only move horizontally or vertically within the room.
The distance between two guests and , written , is the total horizontal and vertical distance they need to travel to reach each other: .
The privacy value of two guests and , written , is the smallest over all with and . In other words, it is decided by how close each of them is to their nearest other guest.
A pair of guests and is an interesting couple if .
Find the minimum value of among all interesting couples.
Input
The first line contains an integer (). Each of the next lines contains two integers and (). No two guests stand at the same location, that is, for .
Under the given constraints, an interesting couple always exists.
Output
Output one integer: the minimum value of among all interesting couples.