結果

問題 No.683 Two Operations No.3
ユーザー roarisroaris
提出日時 2019-09-01 20:01:45
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 448 bytes
コンパイル時間 530 ms
コンパイル使用メモリ 10,884 KB
実行使用メモリ 289,792 KB
最終ジャッジ日時 2023-08-19 12:15:15
合計ジャッジ時間 4,284 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 15 ms
12,332 KB
testcase_01 AC 15 ms
7,736 KB
testcase_02 AC 17 ms
7,816 KB
testcase_03 AC 16 ms
7,812 KB
testcase_04 AC 16 ms
7,784 KB
testcase_05 AC 16 ms
7,832 KB
testcase_06 TLE -
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)

def dfs(A, B):
    if A == 0 and B == 0:
        return True
    elif A % 2 == 0 and B % 2 == 0 and A > 0 and B > 0:
        return dfs(A//2, B-1) or dfs(A-1, B//2)
    elif A % 2 == 0 and B > 0:
        return dfs(A//2, B-1)
    elif B % 2 == 0 and A > 0:
        return dfs(A-1, B//2)
    else:
        return False

A, B = map(int, input().split())

if dfs(A, B):
    print('Yes')
else:
    print('No')
0