結果

問題 No.683 Two Operations No.3
ユーザー lloyzlloyz
提出日時 2022-07-17 14:02:06
言語 PyPy3
(7.3.15)
結果
MLE  
実行時間 -
コード長 473 bytes
コンパイル時間 565 ms
コンパイル使用メモリ 87,020 KB
実行使用メモリ 846,972 KB
最終ジャッジ日時 2023-09-12 01:54:58
合計ジャッジ時間 3,217 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 75 ms
71,096 KB
testcase_01 AC 75 ms
71,484 KB
testcase_02 AC 75 ms
71,360 KB
testcase_03 AC 74 ms
71,376 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**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