BTCODE_A - Traversing Grid
题目描述
Given 2 points in 2 dimensional space (xs,ys) and (xd,yd), your task is to find whether (xd,yd) can be reached from (xs,ys) by making a sequence of zero or more operations.
From a given point (x, y), the operations possible are:
a) Move to point (y, x)
b) Move to point (x, -y)
c) Move to point (x+y, y)
d) Move to point (2\*x, y)
输入输出格式
输入格式
The first line of input contains T, the number of test cases. T lines follow, one for each test case. For each test case, the input contains one line denoting the 4 integers xs, ys, xd, yd
输出格式
Output T lines, one for each test case. For each test case, output "YES" if (xd,yd) is reachable from (xs,ys) and "NO" otherwise. (quotes for clarity)
输入输出样例
输入样例 #1
1
1 1 2 2
输出样例 #1
YES
Constraints:
T <= 25
-10^10 <= xs, ys, xd, yd <= 10^10
Note that, although the input values are constrained by the above inequality, the coordinates of the points
at the intermediate steps need not be.