問題一覧 > 通常問題

No.683 Two Operations No.3

レベル : / AI推定難易度 : 1100 / 実行時間制限 : 1ケース 2.000秒 / メモリ制限 : 512 MB / 標準ジャッジ問題
タグ : (AC するまで非表示) / 解いたユーザー数 189
作問者 : Pulmn / テスター : WA_TLE
お気に入りにしたユーザー ProblemId : 2257 / 自分の提出
問題文最終更新日: 2026-06-26 06:07:38
This statement was translated by AI (claude-opus-5-5, effort medium) and may contain errors or differ in nuance from the original. The original statement takes precedence. Back to the original
yukicoder contest 190 (順位表) の他の問題:

Problem Statement

You are given non-negative integers $A,B$ and have $2$ integers $X=0,Y=0$. You may perform the following $2$ operations any number of times in any order. Determine whether it is possible to make $X=A,Y=B$.

Let $X',Y'$ denote the values of $X,Y$ after an operation, respectively.
Operation 1: $X'=X\times 2$ $,$ $Y'=Y+1$
Operation 2: $X'=X+1$ $,$ $Y'=Y\times 2$

Input

$A$ $B$

$0\le A,B\le 10^{18}$

Output

Print "Yes" if it is possible to make $X=A,Y=B$, and "No" otherwise. Print a newline at the end.

Sample

Sample 1
Input
4 5
Output
Yes

You can make $X=4,Y=5$ by performing the operations in the order Operation 1 $\rightarrow$ Operation 2 $\rightarrow$ Operation 2 $\rightarrow$ Operation 1. In this case, the value of $(X,Y)$ changes as follows.
$(0,0)\rightarrow (0,1)\rightarrow (1,2)\rightarrow (2,4)\rightarrow (4,5)$

Sample 2
Input
1 1
Output
No

Sample 3
Input
0 0
Output
Yes

There are cases where no operation is needed.

提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。