結果

問題 No.683 Two Operations No.3
ユーザー roaris
提出日時 2019-09-01 20:13:08
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 35 ms / 2,000 ms
コード長 359 bytes
コンパイル時間 167 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 10,752 KB
最終ジャッジ日時 2024-11-29 05:22:11
合計ジャッジ時間 1,401 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 16
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
sys.setrecursionlimit(10 ** 6)
def dfs(a, b):
    if a==0 or b==0:
        return True
    if a%2==b%2==1:
        return False
    if a%2==1:
        return dfs(a-1, b//2)
    if b%2==1:
        return dfs(a//2, b-1)
    return dfs(a//2, b-1) or dfs(a-1, b//2)
A, B = map(int, input().split())

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