結果

問題 No.683 Two Operations No.3
ユーザー roaris
提出日時 2019-09-01 20:01:45
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
RE  
実行時間 -
コード長 448 bytes
コンパイル時間 219 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 293,248 KB
最終ジャッジ日時 2024-11-29 05:07:33
合計ジャッジ時間 8,012 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 11 RE * 5
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
sys.setrecursionlimit(10 ** 6)

def dfs(A, B):
    if A == 0 and B == 0:
        return True
    elif A % 2 == 0 and B % 2 == 0 and A > 0 and B > 0:
        return dfs(A//2, B-1) or dfs(A-1, B//2)
    elif A % 2 == 0 and B > 0:
        return dfs(A//2, B-1)
    elif B % 2 == 0 and A > 0:
        return dfs(A-1, B//2)
    else:
        return False

A, B = map(int, input().split())

if dfs(A, B):
    print('Yes')
else:
    print('No')
0