|
<p> |
|
In the ever-popular role-playing game <em>Dungeons & Dragons</em>, or <em>D&D</em>, some wizards enhance their skills by |
|
training as geometers, specialist spellcasters who rely on the inherent magical properties of geometric forms. |
|
<p> |
|
|
|
<p> |
|
Unlike low-level wizards who may be able to fight only a single zombie at a time, you, the budding geometer, are ready and able to |
|
fight medium-sized hordes! |
|
</p> |
|
|
|
<p> |
|
There are <strong>N</strong> zombies on an infinite 2D plane, with the <em>i</em>th one at coordinates (<strong>X<sub>i</sub></strong>, <strong>Y<sub>i</sub></strong>). |
|
You have two spells at your disposal, but you can only cast each one once. |
|
</p> |
|
|
|
<p> |
|
You'll first cast the function-spell <tt>Move(x, y, r, dx, dy)</tt>. |
|
Each of its five parameters can be any real number, though <tt>r</tt> must be positive. |
|
Upon performing this spell, each zombie initially within the circle centered at coordinates (<tt>x</tt>, <tt>y</tt>) and having radius <tt>r</tt> |
|
will have its coordinates translated by (<tt>dx</tt>, <tt>dy</tt>). |
|
In other words, it will have <tt>dx</tt> added to its x-coordinate, and <tt>dy</tt> added to its y-coordinate. |
|
Zombies on the border of the circle are also affected. |
|
</p> |
|
|
|
<p> |
|
You'll then cast the function-spell <tt>Destroy(x, y)</tt>. Each of its two parameters can be any real number. |
|
Upon performing this spell, each zombie currently within the axis-aligned square centered at coordinates (<tt>x</tt>, <tt>y</tt>) |
|
and having side-length <strong>R</strong> will be destroyed. Zombies on the border of the square are also affected. |
|
</p> |
|
|
|
<img src="{{PHOTO_ID:336634350719298}}" /> |
|
<img src="{{PHOTO_ID:268425761045248}}" /> |
|
|
|
<p> |
|
What's the largest number of zombies that can be destroyed by this combination of function-spells? |
|
</p> |
|
|
|
<h3>Input</h3> |
|
|
|
<p> |
|
Input begins with an integer <strong>T</strong>, the number of zombie hordes you fight. |
|
For each case, there is first a line containing two space-separated integers, <strong>N</strong> and <strong>R</strong>. |
|
Then, <strong>N</strong> lines follow, the <em>i</em>th of which contains 2 space-separated integers, |
|
<strong>X<sub>i</sub></strong> and <strong>Y<sub>i</sub></strong>. |
|
</p> |
|
|
|
<h3>Output</h3> |
|
|
|
<p> |
|
For the <em>i</em>th case, print a line containing "Case #<strong>i</strong>: " followed by the maximum number of |
|
zombies you can slay with your spells. |
|
</p> |
|
|
|
<h3>Constraints</h3> |
|
|
|
<p> |
|
1 ≤ <strong>T</strong> ≤ 50 <br /> |
|
1 ≤ <strong>N</strong> ≤ 50 <br /> |
|
0 ≤ <strong>X<sub>i</sub></strong>, <strong>Y<sub>i</sub></strong> ≤ 1,000,000,000 <br /> |
|
1 ≤ <strong>R</strong> ≤ 1,000,000,000 <br /> |
|
</p> |
|
|
|
<p> |
|
It is guaranteed that no two zombies are initially at the same point, though zombies may later be moved such that there are multiple at the same coordinates. |
|
</p> |
|
|
|
<h3>Explanation of Sample</h3> |
|
|
|
<p> |
|
In the first case (shown in the pictures above), one optimal strategy is to first cast <tt>Move(2.5, 4.5, 2.2, 3, -1)</tt>, moving 4 zombies, and then cast <tt>Destroy(5.5, 2.5)</tt>, destroying 6 zombies. |
|
</p> |
|
|