結果

問題 No.683 Two Operations No.3
ユーザー kerotonokerotono
提出日時 2018-05-11 22:35:44
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
RE  
実行時間 -
コード長 441 bytes
コンパイル時間 308 ms
コンパイル使用メモリ 10,952 KB
実行使用メモリ 8,580 KB
最終ジャッジ日時 2023-09-10 17:35:13
合計ジャッジ時間 2,094 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
7,812 KB
testcase_01 AC 16 ms
7,868 KB
testcase_02 AC 16 ms
7,780 KB
testcase_03 AC 16 ms
7,784 KB
testcase_04 RE -
testcase_05 RE -
testcase_06 RE -
testcase_07 AC 16 ms
7,772 KB
testcase_08 RE -
testcase_09 AC 16 ms
7,960 KB
testcase_10 AC 17 ms
7,760 KB
testcase_11 AC 15 ms
7,784 KB
testcase_12 RE -
testcase_13 RE -
testcase_14 AC 16 ms
7,792 KB
testcase_15 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

#!python
# -*- coding: utf-8 -*-

import sys

sys.setswitchinterval(10 ** 8)


def DFS(A, B):
    if A == 0 and B == 0:
        return True
    if A % 2 == 1 and B % 2 == 1:
        return False

    if A % 2 == 1:
        return DFS(A - 1, B // 2)
    elif B % 2 == 1:
        return DFS(A // 2, B - 1)
    else:
        return DFS(A - 1, B // 2) or DFS(A // 2, B - 1)


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