Coder-Strike 2014 - Finals (online edition, Div. 1)
E
Playing the ball
Codeforces
2600
原题
← D→
翻译中…

A coder cannot sit and code all day. Sometimes it is a good idea to rise from the desk, have a rest, have small talk with colleagues and even play. The coders of the F company have their favorite ball game.

翻译中…

Let's imagine the game on the plane with a cartesian coordinate system. The point (0, 0) contains the player who chooses an arbitrary direction and throws a ball in that direction. The ball hits the plane at distance $*d*$ from the player's original position and continues flying in the same direction. After the ball hits the plane for the first time, it flies on and hits the plane again at distance $2·*d*$ from the player's original position and so on (it continue flying in the chosen direction and hitting the plane after each $*d*$ units). All coders in the F company are strong, so the ball flies infinitely far away.

翻译中…

The plane has $*n*$ circles painted on it. If a ball hits the plane and hits a circle that is painted on the plane (including its border), then the player gets one point. The ball can hit multiple circles at once and get one point for each of them (if the ball hits some circle $*x*$ times during the move, the player also gets $*x*$ points). Count the maximum number of points a player can get if he throws a ball in the arbitrary direction. Note that the direction may have real cooridinates.

翻译中…

Input

翻译中…

The first line contains two space-separated integers — $*n*$ и $*d*$ $(1 ≤ *n* ≤ 2·10^{4}; 5 ≤ *d* ≤ 10)$. Next $*n*$ lines contain the circles' description. The $*i*$-th line contains three space-separated integers $*x*_{*i*}$, $*y*_{*i*}$, $*r*_{*i*}$ $( - 10000 ≤ *x*_{*i*}, *y*_{*i*} ≤ 10000; 1 ≤ *r* ≤ 50)$, where $(*x*_{*i*}, *y*_{*i*}, *r*_{*i*})$ are the coordinates of the center and the radius of the circle, correspondingly. The point (0, 0) is not inside or on the border of some circle.

翻译中…

Output

翻译中…

Print a single integer — the maximum number of points you can get.

翻译中…

样例

Input #1
2 5
1 1 1
5 0 1
Output #1
1
InputCopy OutputCopy
Input #2
2 5
4 0 3
5 3 1
Output #2
2
InputCopy OutputCopy
Input #3
1 10
20 0 10
Output #3
3
InputCopy OutputCopy
题目信息
题号
420E
时间限制
2 s
内存限制
256 MB
标签
计算几何

题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。