#P10913. Bracelet Collection Game
Bracelet Collection Game
Bracelet Collection Game
A player is given a huge \(10^8 \times 10^8\) 2D plane. There are \(N\) circular bracelets placed on the plane. The player can place a rectangular frame of size \(w \times h\) anywhere on the plane. Note that the frame may be placed only parallel to the coordinate axes, though it may be rotated by \(90^\circ\) (i.e. you may use dimensions \(w \times h\) or \(h \times w\)). A bracelet with center \((x, y)\) and radius \(r\) is collected if the entire circle (from \(x - r\) to \(x + r\) horizontally and \(y - r\) to \(y + r\) vertically) is contained within the frame. The thickness of both the bracelets and the frame can be neglected, and bracelets may overlap. The bottom-left corner of the plane is at \((0, 0)\).
Your task is to determine the maximum number of bracelets that can be collected by optimally placing the frame.
inputFormat
The first line contains three integers \(N\), \(w\), and \(h\) --- the number of bracelets and the dimensions of the frame.
Each of the following \(N\) lines contains three integers \(x\), \(y\), and \(r\) describing the center coordinates and radius of a bracelet.
outputFormat
Output a single integer representing the maximum number of bracelets that can be collected.
sample
3 5 4
2 2 1
4 2 1
3 4 1
3