Codeforces Round 1082 (Div. 2)
A
Parkour Design
Codeforces
800
原题
←B →
翻译中…

Today, Alex wants to build a parkour course for Steve to train his parkour skills on. A parkour course is a sequence $p_0 \to p_1 \to \ldots \to p_k$ of integer coordinates on the plane. Here, a contiguous pair of coordinates is called a move, denoted as $p_{i-1} \to p_i$.

翻译中…

Alex knows that Steve can only perform the following types of moves:

翻译中…
  • $(x_i,y_i) \to (x_i+2,y_i+1)$;
  • $(x_i,y_i) \to (x_i+3,y_i)$;
  • $(x_i,y_i) \to (x_i+4,y_i-1)$.
翻译中…

Note that Steve will not perform any other type of moves. For example, Steve can perform $(0,0) \to (2,1)$ and $(2,1) \to (5,1)$, but will never perform moves such as $(2,1) \to (3,2)$, $(3,0) \to (5,-1)$, or $(4,-1) \to (6,-1)$ (even though they may look very easy).

翻译中…

You are given an integer coordinate $(x,y)$ on the plane.

翻译中…

Please determine if it is possible to make a parkour course $q_0,q_1,\ldots,q_k$ that satisfies the following conditions:

翻译中…
  • $q_0=(0,0)$;
  • $q_k=(x,y)$;
  • The parkour course only consists of moves that Steve can perform.
翻译中…

Input

翻译中…

Each test contains multiple test cases. The first line contains the number of test cases $t$ ($1 \le t \le 10^3$). The description of the test cases follows.

翻译中…

The only line of each test case contains two integers $x$ and $y$ ($1 \le x \le 10^9$, $-10^8 \le y \le 10^8$).

翻译中…

Output

翻译中…

If it is possible to make a parkour course that satisfies the conditions, output "YES" on a separate line.

翻译中…

If it is impossible to make a parkour course that satisfies the conditions, output "NO" on a separate line.

翻译中…

You can output the answer in any case. For example, the strings "yEs", "yes", and "Yes" will also be recognized as positive responses.

翻译中…

Note

翻译中…

For the fifth test case, the parkour course must start from $(0,0)$ and end on $(14,1)$.

翻译中…

This can be achieved by the following parkour course.

翻译中…

$$(0,0) \to (4,-1) \to (7,-1) \to (9,0) \to (12,0) \to (14,1)$$

翻译中…

Note that the following parkour course does not satisfy the third condition stated above due to the moves highlighted in red.

翻译中…

$$(0,0) \to \color{red}{(4,-1) \to (6,-1)} \to (8,0) \to \color{red}{(11,0) \to (14,1)}$$

翻译中…

样例

Input #1
11
2 1
3 0
4 -1
4 1
14 1
1 -4
3 -1
2 10
24 -1
24 -3
8 4
Output #1
YES
YES
YES
NO
YES
NO
NO
NO
NO
YES
YES
InputCopy OutputCopy
题目信息
题号
2202A
时间限制
1 s
内存限制
256 MB
标签
数学

题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。