#P2928. [USACO09HOL] Cattle Bruisers G

[USACO09HOL] Cattle Bruisers G

Description

Canmuu is out for revenge after being utterly defeated by Bessie in paintball and has challenged Bessie to a video game.

In this game, Bessie starts out at point (BX,BY)(BX, BY) in the coordinate grid (1,000BX1,000;1000BY1,000)(-1,000 \le BX \le 1,000; -1000 \le BY \le 1,000), and tries to escape, starting at time 0. She moves continuously at a velocity of (BVX,BVY)(BVX, BVY) units/second (100BVX100;100BVY100)(-100 \le BVX \le 100; -100 \le BVY \le 100). Thus, at time 1 she will be at point (BX+BVX,BY+BVY)(BX + BVX, BY + BVY); at time 1.51.5 she will be at (BX+1.5×BVX,BY+1.5×BVY)(BX + 1.5 \times BVX, BY + 1.5\times BVY).

Unfortunately, Canmuu has sent N(1N50,000)N (1 \le N \le 50,000) cattle bruisers to pursue Bessie. At time t=0t=0, cattle bruiser i is at position $(X_i, Y_i) (-1,000 \le X_i \le 1,000; -1,000 \le Y_i \le 1,000)$ with velocity (VXi,VYi)(VX_i, VY_i) units/second $(-1,000 \le VX_i \le 1,000; -1,000 \le VY_i \le 1,000)$.

Each cattle bruiser carries a 'proximity' weapon to fire at Bessie; the weapon can hurt Bessie when the cattle bruiser is no further than R(1R2,500)R (1 \le R \le 2,500) units from her.

Bessie has a shield to protect herself from these attacks. However, she does not want to waste any of her shield's power, so she would like to know the maximum number of cattle bruisers within firing range for any (potentially non-integer) time.

In order to avoid precision errors with real numbers, it is guaranteed that the answer produced will be the same whether the attack range is decreased to R0.0001R-0.0001 or increased to R+0.0001R+0.0001.

FEEDBACK: Your first 5050 submissions for this problem will be run on some of the official test data, and you will receive a summary of the results.

自从卡门在弹珠游戏中被贝茜彻底击败,他一直在想找机会复仇。这会儿,他邀贝茜去玩一个电脑游戏。

游戏中,贝茜在(BX,BYB_X,B_Y)处开始行动,这时时刻为 00。她要试图逃离。她的速度为 (BVXBVYBV_X,BV_Y) 每秒。

不幸的是,卡门为了复仇,放出 N(1N50000)N (1\le N\le 50000) 个杀手追击贝茜。

t=0t = 0 时,杀手 ii 的位置是 XiX_i, YiY_i 他的速度是 Vxi,VyiVx_i,Vy_i 每秒。

由于每个杀手配备了手枪,手枪的射程是 RR,也就是说贝茜要与这个杀手的距离需要保持超过 RR,否则有性命之虞。

然而,贝茜还有一件秘密武器,盾。但是,她不想过多地消耗盾的能量。所以,她想知道在逃脱过程中,某一个时刻她在最多为多少个杀手的射程内。当然这个时刻不一定是整数。

为了防止出现精度误差,数据保证在 r+104Rr+104r+10^{-4}\le R\le r+10^{-4} 时也能得出正确结果。

Input Format

* Line 11: Six space-separated integers: NN, RR, BXBX, BYBY, BVXBVX, and BVYBVY.

* Lines 22 ~ N+1N+1: Line i+1 contains four space-separated integers: XiX_i, YiY_i, VXiVX_i, and VYiVY_i.

第一行:六个整数:N,R,BX,BY,BVX,BVYN,R,B_X,B_Y,BV_X,BV_Y.

nn 行每行包含四个整数:Xi,Yi,Vxi,VyiX_i,Y_i,Vx_i,Vy_i.

Output Format

* Line 11: Print a single integer denoting the maximum number of cattle bruisers within attack range at any point in time.

输出一个整数,表示在任意时刻攻击范围内最多可存在的杀手数量。

3 1 0 0 0 2 
0 -3 0 4 
1 2 -1 1 
1 -2 2 -1 

2 

Hint

Bessie starts at point (0,0)(0, 0) and is moving at 22 units per second in the (positive) y-direction. There are 33 cattle bruisers, the first of which starts at point (0,3)(0, -3) and travels 44 units per second in the y-direction. The maximum distance for a cattle bruiser to be in range of Bessie is 11 unit.

At time 1.51.5, Bessie is at point (0,3)(0, 3), and the three bruisers are at points (0,3)(0, 3), (0.5,3.5)(-0.5, 3.5), and (4,3.5)(4, -3.5). The first two cattle bruisers are within 11 unit of Bessie, while the third will never be within 11 unit of Bessie, so 22 is the most achievable.

样例解释:

贝茜从点 (0,0)(0, 0) 出发,以每秒 22 个单位的速度沿 y 轴正方向移动。有 33 个杀手,其中第一个从点 (0,3)(0, -3) 出发,以每秒 44 个单位的速度沿 y 轴移动。杀手与贝茜的最远有效距离为 11 个单位。

在时刻 1.51.5,贝茜位于点 (0,3)(0, 3),而三个杀手分别位于点 (0,3),(0.5,3.5)(0, 3),(-0.5, 3.5)(4,3.5)(4, -3.5)。前两个杀手与贝茜的距离均不超过 11 单位,但第三个杀手永远无法进入贝茜 11 单位范围内,因此最多可存在的杀手数量为 22