This page is still under construction.

Parts of this page are still being built. What you see may change.

Escape from the Minefield

Time limit2sMemory limit512 MB

Summary
Each mine kills within 2 meters; find the largest disk centered at the origin (radius r) that can slide clear of all mines, then output floor(pi r^2).
Level

Hard8 of 10

Topics
Geometry, Graph, BFS, Binary search
Solved
No attempts yet

Problem

After a failed parachute drop, Lieutenant Jones and his platoon land in the middle of an enemy minefield instead of at their target coordinates.

Jones carries an accurate map showing the location of every mine. Each anti-personnel mine has a blast-and-detection radius of 22 meters: anyone who comes within 22 meters of a mine dies.

For the moment the platoon is safe, hidden beneath a bush at Jones' position. They will escape in a single circular formation: a disk of radius rr centered on the bush. Each soldier needs 11 square meter of area on average, so a formation of radius rr can hold ⌊πr2⌋\lfloor \pi r^2 \rfloor soldiers.

The formation must stay outside every mine's blast radius at all times. That is:

  • At the start, the whole disk (centered on the bush) must lie at least 22 meters away from every mine.
  • To escape, the disk must be able to move from the bush all the way out of the field, and at every moment no point of the disk may come within 22 meters of any mine (the disk has to squeeze through the gaps between mines).

Jones wants to bring out as many soldiers as possible; anyone who does not fit inside the largest formation that can safely escape is left behind to be captured. Determine that maximum number of soldiers.

Input

The first line contains a positive integer TT, the number of test cases. Each test case is given as follows:

  • A line with a single positive integer nn (1≤n<1051 \le n < 10^5), the number of mines.
  • nn lines follow, each with two integers xx and yy (∣x∣,∣y∣<105|x|, |y| < 10^5): the coordinates in meters of a mine relative to Jones' position (the bush is at the origin). No two mines share the same coordinates.

Output

For each test case, output a single line containing one integer: the maximum number of soldiers that can escape.

Examples3

  1. Example 1

    Input
    3
    3
    2 2
    2 -2
    -2 -2
    8
    4 2
    4 -1
    1 4
    -2 4
    -4 2
    -4 -2
    -1 -4
    2 -4
    7
    -10 -1
    -4 3
    -4 -4
    -1 -6
    2 4
    3 -4
    7 0
    
    Expected output
    2
    0
    7
    
  2. Example 2

    Input
    1
    1
    5 0
    
    Expected output
    28
    
  3. Example 3

    Input
    1
    4
    6 0
    0 6
    -6 0
    0 -6
    
    Expected output
    15