結果

問題 No.683 Two Operations No.3
ユーザー kerotono
提出日時 2018-05-11 23:55:51
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 33 ms / 2,000 ms
コード長 681 bytes
コンパイル時間 100 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 10,752 KB
最終ジャッジ日時 2024-06-28 09:56:56
合計ジャッジ時間 1,232 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 16
権限があれば一括ダウンロードができます

ソースコード

diff #

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

import sys

sys.setrecursionlimit(10 ** 8)


def DFS(A, B):
    if A == 0 or B == 0:
        return True
    if A % 2 == 1 and B % 2 == 1:
        return False
    if A % 4 == 2 and B % 4 == 2:
        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')
# for x in range(100):
#     for y in range(100):
#         a = 4 * x + 1
#         b = 4 * y + 2
#         if DFS(a, b):
#             print(a, b)
#         else:
#             print()
0