結果

問題 No.683 Two Operations No.3
ユーザー prd_xxx
提出日時 2018-05-11 22:49:07
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
MLE  
実行時間 -
コード長 452 bytes
コンパイル時間 87 ms
コンパイル使用メモリ 12,416 KB
実行使用メモリ 817,664 KB
最終ジャッジ日時 2024-06-28 08:54:25
合計ジャッジ時間 3,622 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 4 MLE * 1 -- * 11
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
sys.setrecursionlimit(10**7)

X,Y = map(int,input().split())
mem = {}
def dfs(x,y):
    if x == y == 0: return True
    if x < 0 or y < 0: return False
    if x%2 and y%2: return False
    if (x,y) in mem:
        return mem[(x,y)]
    if x%2:
        ret = dfs(x-1,y//2)
    elif y%2:
        ret = dfs(x//2,y-1)
    else:
        ret = dfs(x-1,y//2) or dfs(x//2,y-1)
    mem[(x,y)] = ret
    return ret

print('Yes' if dfs(X,Y) else 'No')
0