No.2628 Shrinkage
Problem Statement
There are $2$ points $P_1(x_1,y_1),P_2(x_2,y_2)$ on the $xy$-plane.
You may perform the following sequence of operations on them any number of times, $0$ or more.
- Choose any $1$ point on the $xy$-plane and call it $C(x_c,y_c)$.
- Choose any real number satisfying $0\lt k\lt 1$.
- Let $d_1$ be the distance between $P_1$ and $C$. Move $P_1$ toward $C$ by $d_1k$.
- Let $d_2$ be the distance between $P_2$ and $C$. Move $P_2$ toward $C$ by $d_2k$.
Is it possible to make $P_1,P_2$ coincide with $Q_1(X_1,Y_1),Q_2(X_2,Y_2)$, respectively, at the same time?
Find the answer for each of the $T$ cases.
Constraints
- All input values are integers.
- $1\le T\le 100$
- $0\le x_1,y_1,x_2,y_2,X_1,Y_1,X_2,Y_2\le 10^9$
- $(x_1,y_1)\neq (x_2,y_2)$
- $(X_1,Y_1)\neq (X_2,Y_2)$
Input
$T$
$\mathrm{test}_1$
$\mathrm{test}_2$
$\vdots$
$\mathrm{test}_T$
Here, $\mathrm{test}_i$ denotes the $i$-th test case.
Each test case is given in the following format.
$x_1$ $y_1$ $x_2$ $y_2$ $X_1$ $Y_1$ $X_2$ $Y_2$
Output
Print $T$ lines. On the $i$-th line, print the following for the $i$-th test case.
If it is possible to make $P_1,P_2$ coincide with $Q_1(X_1,Y_1),Q_2(X_2,Y_2)$, respectively, at the same time, print Yes.
Otherwise, print No.
Sample
Sample 1
Input
3 0 6 6 6 2 2 4 2 3 1 4 1 5 9 2 6 1 1 2 2 3 3 4 4
Output
Yes No No
For the $1$st test case, choosing $(3,0),\dfrac{2}{3}$ as $C,k$ makes them coincide in $1$ operation.
提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。
noya2