結果

問題 No.683 Two Operations No.3
ユーザー lloyz
提出日時 2022-07-17 14:00:56
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
RE  
実行時間 -
コード長 473 bytes
コンパイル時間 250 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 572,196 KB
最終ジャッジ日時 2024-06-29 15:04:28
合計ジャッジ時間 6,800 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 6 RE * 2 MLE * 1 -- * 7
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
sys.setrecursionlimit(10**6)

memo = dict()
def f(a, b):
    if (a, b) in memo:
        return memo[(a, b)]
    
    if a == 0 and b == 0:
        return True
    if a % 2 == 0 and f(a // 2, b - 1):
        memo[(a, b)] = True
        return True
    if b % 2 == 0 and f(a - 1, b // 2):
        memo[(a, b)] = True
        return True
    memo[(a, b)] = False
    return False

a, b = map(int, input().split())
if f(a, b):
    print("Yes")
else:
    print("No")
0