結果

問題 No.683 Two Operations No.3
コンテスト
ユーザー mkawa2
提出日時 2020-01-22 21:24:35
言語 Python3
(3.14.3 + numpy 2.4.4 + scipy 1.17.1)
コンパイル:
python3 -mpy_compile _filename_
実行:
python3 _filename_
結果
AC  
実行時間 96 ms / 2,000 ms
コード長 499 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 490 ms
コンパイル使用メモリ 20,700 KB
実行使用メモリ 15,360 KB
最終ジャッジ日時 2026-03-30 17:05:25
合計ジャッジ時間 3,827 ms
ジャッジサーバーID
(参考情報)
judge1_0 / judge2_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 16
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

import sys

sys.setrecursionlimit(10 ** 6)
def MI(): return map(int, sys.stdin.readline().split())

def main():
    memo={}
    def ok(a, b):
        if a * b == 0: return True
        if a > b: a, b = b, a
        if (a,b) in memo:return memo[a,b]
        res = False
        if a % 2 == 0: res |= ok(a // 2, b - 1)
        if b % 2 == 0: res |= ok(a - 1, b // 2)
        memo[a,b]=res
        return res

    a, b = MI()
    if ok(a, b):
        print("Yes")
    else:
        print("No")

main()
0