AT_abc467_d.Concentric Circles

普及/提高-

通过率:0%

时间限制:2.00s

内存限制:1024MB

AC君温馨提醒

该题目为【atcoder】题库的题目,您提交的代码将被提交至atcoder进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

Do there exist two circles C1C_1 and C2C_2 on the xyxy-plane satisfying all of the following conditions? Here, C1C_1 and C2C_2 may coincide.

  • The two distinct points (Px,Py)(P_x, P_y) and (Qx,Qy)(Q_x, Q_y) lie on the circumference of C1C_1.
  • The two distinct points (Rx,Ry)(R_x, R_y) and (Sx,Sy)(S_x, S_y) lie on the circumference of C2C_2.
  • C1C_1 and C2C_2 have the same center.

You are given TT test cases; solve each of them.

在 xyxy-平面上是否存在两个圆 C1C_1 和 C2C_2,满足以下所有条件?其中,C1C_1 和 C2C_2 可以重合。

  • 两个不同的点 (Px,Py)(P_x, P_y) 和 (Qx,Qy)(Q_x, Q_y) 位于圆 C1C_1 的圆周上。
  • 两个不同的点 (Rx,Ry)(R_x, R_y) 和 (Sx,Sy)(S_x, S_y) 位于圆 C2C_2 的圆周上。
  • C1C_1 和 C2C_2 具有相同的圆心。

你将得到 TT 组测试数据;请对每组数据进行求解。

输入格式

The input is given from Standard Input in the following format:

TT
case1\mathrm{case}_1
case2\mathrm{case}_2
⋮\vdots
caseT\mathrm{case}_T

Each test case caset\mathrm{case}_t is given in the following format:

PxP_x PyP_y QxQ_x QyQ_y RxR_x RyR_y SxS_x SyS_y

输入从标准输入给出,格式如下:

TT
case1\mathrm{case}_1
case2\mathrm{case}_2
⋮\vdots
caseT\mathrm{case}_T

每个测试用例 caset\mathrm{case}_t 的格式如下:

PxP_x PyP_y QxQ_x QyQ_y RxR_x RyR_y SxS_x SyS_y

输出格式

Output TT lines. The tt-th line should contain the answer to the tt-th test case.
For each test case, output Yes if there exist two circles C1C_1 and C2C_2 satisfying all of the conditions, and No otherwise.

输出 TT 行。第 tt 行应包含第 tt 个测试用例的答案。
对每个测试用例,若存在两个圆 C1C_1 和 C2C_2 满足所有条件,则输出 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 C1C_1 be the circle with center (1,0)(1,0) and radius 11, and C2C_2 be the circle with center (1,0)(1,0) and radius 22, the conditions are satisfied.

For the second test case, letting both C1C_1 and C2C_2 be the circle with center (0,0)(0,0) and radius 11 satisfies the conditions.

image

Constraints

  • 1≤T≤5×1041 \leq T \leq 5 \times 10^4
  • −109≤Px,Py,Qx,Qy,Rx,Ry,Sx,Sy≤109-10^9 \leq P_x,P_y,Q_x,Q_y,R_x,R_y,S_x,S_y \leq 10^9
  • (Px,Py)≠(Qx,Qy)(P_x, P_y) \neq (Q_x, Q_y)
  • (Rx,Ry)≠(Sx,Sy)(R_x, R_y) \neq (S_x, S_y)
  • All input values are integers.

样例 1 解释:
考虑第一个测试用例。如下图所示,若令 C1C_1 为圆心在 (1,0)(1,0)、半径为 11 的圆,C2C_2 为圆心在 (1,0)(1,0)、半径为 22 的圆,则满足所有条件。

对于第二个测试用例,令 C1C_1 和 C2C_2 均为圆心在 (0,0)(0,0)、半径为 11 的圆,即可满足所有条件。

image

约束条件

  • 1≤T≤5×1041 \leq T \leq 5 \times 10^4
  • −109≤Px,Py,Qx,Qy,Rx,Ry,Sx,Sy≤109-10^9 \leq P_x,P_y,Q_x,Q_y,R_x,R_y,S_x,S_y \leq 10^9
  • (Px,Py)≠(Qx,Qy)(P_x, P_y) \neq (Q_x, Q_y)
  • (Rx,Ry)≠(Sx,Sy)(R_x, R_y) \neq (S_x, S_y)
  • 所有输入值均为整数。

输入解题思路,AI测评打分。不知道怎么写?

首页