AT_abc467_d.Concentric Circles
普及/提高-
通过率:0%
时间限制:2.00s
内存限制:1024MB
AC君温馨提醒
该题目为【atcoder】题库的题目,您提交的代码将被提交至atcoder进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
Do there exist two circles C1 and C2 on the xy-plane satisfying all of the following conditions? Here, C1 and C2 may coincide.
- The two distinct points (Px,Py) and (Qx,Qy) lie on the circumference of C1.
- The two distinct points (Rx,Ry) and (Sx,Sy) lie on the circumference of C2.
- C1 and C2 have the same center.
You are given T test cases; solve each of them.
在 xy-平面上是否存在两个圆 C1 和 C2,满足以下所有条件?其中,C1 和 C2 可以重合。
- 两个不同的点 (Px,Py) 和 (Qx,Qy) 位于圆 C1 的圆周上。
- 两个不同的点 (Rx,Ry) 和 (Sx,Sy) 位于圆 C2 的圆周上。
- C1 和 C2 具有相同的圆心。
你将得到 T 组测试数据;请对每组数据进行求解。
输入格式
The input is given from Standard Input in the following format:
T
case1
case2
⋮
caseT
Each test case caset is given in the following format:
Px Py Qx Qy Rx Ry Sx Sy
输入从标准输入给出,格式如下:
T
case1
case2
⋮
caseT
每个测试用例 caset 的格式如下:
Px Py Qx Qy Rx Ry Sx Sy
输出格式
Output T lines. The t-th line should contain the answer to the t-th test case.
For each test case, output Yes if there exist two circles C1 and C2 satisfying all of the conditions, and No otherwise.
输出 T 行。第 t 行应包含第 t 个测试用例的答案。
对每个测试用例,若存在两个圆 C1 和 C2 满足所有条件,则输出 Yes;否则输出 No。
输入输出样例
输入#1
3 2 0 1 1 -1 0 1 2 1 0 -1 0 0 1 0 -1 4 0 3 1 2 0 1 1
输出#1
Yes Yes No
说明/提示
Sample 1 Explanation:
Consider the first test case. As shown in the figure below, if we let C1 be the circle with center (1,0) and radius 1, and C2 be the circle with center (1,0) and radius 2, the conditions are satisfied.
For the second test case, letting both C1 and C2 be the circle with center (0,0) and radius 1 satisfies the conditions.

Constraints
- 1≤T≤5×104
- −109≤Px,Py,Qx,Qy,Rx,Ry,Sx,Sy≤109
- (Px,Py)=(Qx,Qy)
- (Rx,Ry)=(Sx,Sy)
- All input values are integers.
样例 1 解释:
考虑第一个测试用例。如下图所示,若令 C1 为圆心在 (1,0)、半径为 1 的圆,C2 为圆心在 (1,0)、半径为 2 的圆,则满足所有条件。
对于第二个测试用例,令 C1 和 C2 均为圆心在 (0,0)、半径为 1 的圆,即可满足所有条件。

约束条件
- 1≤T≤5×104
- −109≤Px,Py,Qx,Qy,Rx,Ry,Sx,Sy≤109
- (Px,Py)=(Qx,Qy)
- (Rx,Ry)=(Sx,Sy)
- 所有输入值均为整数。
输入解题思路,AI测评打分。不知道怎么写?