#P49. Isoball: 2D Version

Isoball: 2D Version

题目描述

Isoball is a challenging and fun game, and in this problem, we consider its 2D version. Given the radius of a circle and its initial position, there is a rectangle on the plane, and your goal is to let the circle be in the interior of the rectangle. To do this, you determine the direction of movement for the circle (represented by a vector). Now, you want to know if there exists a moment (including the initial moment) when the circle moves in this direction to reach the goal.

For a circle with center at (p,q)(p,q) and radius rr, it is considered to be inside a rectangle with bottom-left corner at (lx,ly)(l_x,l_y) and top-right corner at (rx,ry)(r_x,r_y) if and only if p{(x,y)  (xp)2+(yq)2r2}\forall p\in\{(x,y)\ |\ (x-p)^2+(y-q)^2\le r^2\}, it holds that lxpxrxl_x\le p_x\le r_x and lypyryl_y\le p_y\le r_y, where px,pyp_x,p_y are the horizontal and vertical coordinates of point pp, respectively.

输入格式

The first line contains an integer TT (1T104)(1\le T\le 10^4), indicating the number of test cases.

For each test case, the first line contains five integers x,y,r,vx,vyx,y,r,v_x,v_y (106x,y,vx,vy106, 1r106)(-10^6\le x,y,v_x,v_y\le 10^6,\ 1\le r\le 10^6), representing the initial horizontal and vertical coordinates of the circle's center, the radius of the circle, and the direction of movement. It's guaranteed that both vxv_x and vyv_y are not simultaneously equal to 00.

The second line contains four integers lx,Ly,rx,ryl_x,L_y,r_x,r_y (106lx,ly,rx,ry106)(-10^6\le l_x,l_y,r_x,r_y\le 10^6), representing the horizontal and vertical coordinates of the bottom-left and top-right corners of the rectangle. It's guaranteed that lxrxl_x\le r_x and lyryl_y\le r_y.

输出格式

For each test case, output one line. If the goal can be achieved, output Yes; otherwise, output No.

5
0 0 1 1 0
2 -2 6 2
0 0 1 1 0
2 0 6 2
0 0 1 1 1
1 1 3 3
0 0 1 -1 -1
1 1 3 3
0 0 1 -1 1
-5 -5 5 5
Yes
No
Yes
No
Yes

题目大意

在二维平面上给你一个圆,圆的移动方向和一个矩形,问你这个圆有没有可能在一个时刻处于矩形内部。

题目来源

2024-ICPC四川省大学生程序设计竞赛 - F题