atcoder#AGC051F. [AGC051F] rng_58's Last Problem
[AGC051F] rng_58's Last Problem
Score : points
Problem Statement
You have two sandglasses: a sandglass that can measure second, and a sandglass that can measure seconds. Is it possible to measure seconds using them?
Let's formalize the statement. We have two sandglasses named and . 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 gram of sand and the sandglass B contains grams of sand. Thus, when sandglass is vertically placed and all sand is in the top bulb, it takes second until all sand falls into the bottom bulb. Similarly, this time is seconds for sandglass .
Initially, both and 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 seconds after Snuke shouts, we say that we can measure 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 seconds as follows:
- At time , Snuke shouts. Turn both and upside down.
- At time , an event happens: the sand in stops falling down. Turn upside down again (and leave as it is).
- At time , an event happens: the sand in stops falling down. Turn upside down again, and leave in the horizontal state.
- At time , an event happens: the sand in stops falling down.
You are given numbers of the form . Solve the problem above for each given number.
Constraints
- All values in the input are integers.
Input
Input is given from Standard Input in the following format:
Output
Print lines.
On the -th line, print Yes
if it is possible to measure seconds; otherwise print No
.
3
-1 2
2020 1227
2 -1
Yes
Yes
No