結果

問題 No.683 Two Operations No.3
ユーザー prd_xxxprd_xxx
提出日時 2018-05-11 22:49:07
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
MLE  
実行時間 -
コード長 452 bytes
コンパイル時間 268 ms
コンパイル使用メモリ 10,812 KB
実行使用メモリ 816,404 KB
最終ジャッジ日時 2023-09-10 17:42:58
合計ジャッジ時間 3,257 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 15 ms
7,796 KB
testcase_01 AC 15 ms
7,852 KB
testcase_02 AC 15 ms
7,764 KB
testcase_03 AC 14 ms
7,812 KB
testcase_04 MLE -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
権限があれば一括ダウンロードができます

ソースコード

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