← 返回 capitalone 的题目列表Counting Overlapping Crystal Field Pairs on Grid
类型:online_judge
capitalone
In a distant universe, there exists a planet entirely covered in crystals with vibrant energy. These crystals can communicate among themselves, but their transmissions are only successful if the crystals are located close to each other. You are presented with a list of integer pairs called [code]centers[/code], where each pair represents the coordinates of a crystal on this planet. Each crystal projects a field of influence forming a square area around itself with sides measuring 2 units. Two crystal fields are said to intersect if they share at least one point. Determine how many pairs of crystals have overlapping fields.
Example
Input
[[1, 1], [2, 2], [0, 4]]