結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
12,360 KB
testcase_01 AC 16 ms
7,860 KB
testcase_02 AC 16 ms
7,844 KB
testcase_03 AC 16 ms
7,748 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)

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

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

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