結果

問題 No.683 Two Operations No.3
ユーザー lloyzlloyz
提出日時 2022-07-17 14:00:56
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 473 bytes
コンパイル時間 259 ms
コンパイル使用メモリ 10,808 KB
実行使用メモリ 294,936 KB
最終ジャッジ日時 2023-09-12 01:53:29
合計ジャッジ時間 3,928 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
14,820 KB
testcase_01 AC 16 ms
7,788 KB
testcase_02 AC 15 ms
7,784 KB
testcase_03 AC 17 ms
7,780 KB
testcase_04 TLE -
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