Triway Cup '18 Summer E - Eyes of Void
View as PDF
In his second flashback, Bai Yuechu recalls Tushan's greatest enemy: the Queen of the Black Foxen. In one of their legendary fights with her, his ancestor, Dongfang Yuechu uses the "Tear void" ability.
The Queen of the Black Foxen can be modelled as a 2D plane (see picture), with the point that the tear void hits being . The tear void then expands in a circle.
Her body has  "magical points", represented as coordinates on the 2D plane. The 
-th point, if hit by the tear void, deals 
 damage to her. However, expanding the tear void also causes Dongfang Yuechu to expend energy. Specifically, a tear void with radius 
 costs 
 energy, where 
 is a constant in the input. Dongfang wants to measure his effectiveness, which is defined as the 
, for all 
 which are inside the circle. Help him calculate the maximum effectiveness he can have.
Input Specification
Line 1:  (
)
Next  lines: 3 integers 
, representing a point with damage 
 at 
. (
).
Sample Input
10 3
36 5 0
30 -8 -2
61 -5 -4
74 -2 3
19 -7 -4
21 -5 -4
75 9 -5
29 10 -8
81 8 2
99 3 -7
Sample Output
217
Comments