P22023 [HackerRank] Possible path
普及-
题目描述

Adam is standing at point $(a,b)$ in an infinite 2D grid. He wants to know if he can reach point $(x,y)$ or not. The only operation he can do is to move to point $(a+b,b),(a,a+b),(a-b,b),\text{or}(a,b-a)$ from some point $(a,b)$. It is given that he can move to any point on this 2D grid, i.e., the points having positive or negative [MATH4] co-ordinates.

Tell Adam whether he can reach $(x,y)$ or not.

Input Format

The first line contains an integer, $\mathbf{T}$, followed by $\mathbf{T}$ lines, each containing $4$ space-separated integers i.e. $\boldsymbol{a}$, $\boldsymbol{b}$, $\boldsymbol{x}$ and $y$.

Constraints

$1\leq T\leq1000$
$1\leq a,b,x,y\leq10^{18}$

Output Format

For each test case, display YES or NO that indicates if Adam can reach $(x,y)$ or not.

Sample Input
3
1 1 2 3
2 1 2 3
3 3 1 1

Sample Output
YES
YES
NO

Explanation

(1,1) -> (2,1) -> (2,3).

输入格式

见题面

输出格式

见题面

样例输入
3 1 1 2 3 2 1 2 3 3 3 1 1
样例输出
YES YES NO