結果

問題 No.683 Two Operations No.3
ユーザー H3PO4H3PO4
提出日時 2020-11-24 11:44:20
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
RE  
実行時間 -
コード長 360 bytes
コンパイル時間 178 ms
コンパイル使用メモリ 10,688 KB
実行使用メモリ 9,336 KB
最終ジャッジ日時 2023-10-01 00:51:06
合計ジャッジ時間 1,611 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 20 ms
8,608 KB
testcase_01 AC 22 ms
8,616 KB
testcase_02 AC 22 ms
8,616 KB
testcase_03 AC 22 ms
8,800 KB
testcase_04 RE -
testcase_05 RE -
testcase_06 RE -
testcase_07 AC 20 ms
8,644 KB
testcase_08 RE -
testcase_09 RE -
testcase_10 AC 20 ms
8,604 KB
testcase_11 AC 21 ms
8,644 KB
testcase_12 RE -
testcase_13 RE -
testcase_14 AC 21 ms
8,672 KB
testcase_15 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

from functools import lru_cache


@lru_cache(None)
def rec(a, b):
    if a == b == 0:
        return True
    elif a % 2 and b % 2:
        return False

    res = False
    if not a % 2:
        res |= rec(a // 2, b - 1)
    if not b % 2:
        res |= rec(a - 1, b // 2)
    return res


A, B = map(int, input().split())
print('Yes' if rec(A, B) else 'No')
0