AtCoder Grand Contest 051 (Good Bye rng_58 Day 2)
F
rng_58's Last Problem
AtCoder
⌀ 4061
原题
← E→
翻译中…

Problem Statement

翻译中…

You have two sandglasses: a sandglass that can measure $1$ second, and a sandglass that can measure $\sqrt{2}$ seconds. Is it possible to measure $x + y \sqrt{2}$ seconds using them?

翻译中…

Let's formalize the statement. We have two sandglasses named $A$ and $B$. Each sandglass has two bulbs, and the bulbs may contain sand. We can place each sandglass in one of the three states: two vertical states (one of the bulbs is placed on top of the other, and in case the top bulb contains sand, the sand in the top bulb keeps falling into the bottom bulb at the speed of one gram per second.) and one horizontal state (the sand does not move.)

翻译中…

The sandglass A contains $1$ gram of sand and the sandglass B contains $\sqrt{2}$ grams of sand. Thus, when sandglass $A$ is vertically placed and all sand is in the top bulb, it takes $1$ second until all sand falls into the bottom bulb. Similarly, this time is $\sqrt{2}$ seconds for sandglass $B$.

翻译中…

Initially, both $A$ and $B$ are vertically placed, and all sand is in the bottom bulb. You are not allowed to touch anything before Snuke shouts. When an event (described below) happens exactly $t$ seconds after Snuke shouts, we say that we can measure $t$ seconds.

翻译中…

We say that an event happens when one of the following happens:

翻译中…
  • Snuke shouts.
  • The sand in a sandglass in a vertical state has just stopped falling down.
翻译中…

When an event happens, we can perform (an arbitrary number of) the following operation in negligible time:

翻译中…
  • Choose a sandglasses, and change its state.
翻译中…

For example, we can measure $-1 + 2 \sqrt{2}$ seconds as follows:

翻译中…
  • At time $0$, Snuke shouts. Turn both $A$ and $B$ upside down.
  • At time $1$, an event happens: the sand in $A$ stops falling down. Turn $A$ upside down again (and leave $B$ as it is).
  • At time $\sqrt{2}$, an event happens: the sand in $B$ stops falling down. Turn $A$ upside down again, and leave $B$ in the horizontal state.
  • At time $-1 + 2 \sqrt{2}$, an event happens: the sand in $A$ stops falling down.
翻译中…

You are given $Q$ numbers of the form $x_i + y_i \sqrt{2}$. Solve the problem above for each given number.

翻译中…

Constraints

翻译中…
  • $1 \leq Q \leq 10^5$
  • $-10^9 \leq x_i, y_i \leq 10^9$
  • $x_i + y_i \sqrt{2} > 0$
  • All values in the input are integers.
翻译中…

Input

翻译中…

Input is given from Standard Input in the following format:

翻译中…

Q
x_1 y_1
:
x_Q y_Q

翻译中…

Output

翻译中…

Print $Q$ lines. On the $i$-th line, print Yes if it is possible to measure $x_i + y_i \sqrt{2}$ seconds; otherwise print No.

翻译中…

样例

Input #1
3
-1 2
2020 1227
2 -1
Output #1
Yes
Yes
No
题目信息
题号
agc051_f
时间限制
2 s
内存限制
1024 MB

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