Choose the largest subset of given grid points so every pair is more than 1.3 meters apart.
Medium6GraphGreedyGeometryBrute forceNo attempts yetTime limit2sMemory limit512 MBThe park management decided to install boxing machines at several places in the park. Machines have been in short supply, so this time they want to put up as many as they can. The park will still not fill up with machines, because the legal limits on where a machine may stand are strict.
The management marked every possible machine position on the park plan and wrote down its coordinates. The manufacturer's safety rule applies as well. The distance between any two boxing machines is at least 1.3 meters.
Find the largest number of boxing machines that can be installed without breaking that rule.
The input holds several test cases. The first line of each test case has one integer N, the number of possible machine positions in the park (1≤N≤2000). Each of the next N lines describes one position with two integer coordinates in meters. Every coordinate is at least 0 and at most 109. The same coordinate pair never appears twice inside one test case.
The positions of one test case form a single connected group. Starting from any position you can reach every other position by steps that change exactly one coordinate by 1 and always land on a position where a machine may stand.
There are at most 100 test cases, and the sum of N over all test cases is at most 20000. The input ends at end of file.
For each test case, print one line with the largest number of boxing machines that can be installed.