結果

問題 No.1465 Archaea
ユーザー nephrologistnephrologist
提出日時 2021-04-02 22:03:55
言語 PyPy3
(7.3.15)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 480 bytes
コンパイル時間 462 ms
コンパイル使用メモリ 82,304 KB
実行使用メモリ 55,168 KB
最終ジャッジ日時 2024-12-24 01:18:46
合計ジャッジ時間 2,036 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 19 WA * 1
権限があれば一括ダウンロードができます

ソースコード

diff #

from functools import lru_cache

n, k = map(int, input().split())


@lru_cache(None)
def calc(a, b):
    if a == 1:
        return True
    if b == 0:
        return False

    res = False

    if a % 2 == 0 and b >= 1:
        res |= calc(a // 2, b - 1)
    if a % 2 == 1:
        if a == 3:
            return False
        else:
            if b - 2 >= 0:
                res |= calc((a - 3) // 2, b - 2)

    return res


if calc(n, k):
    print("YES")
else:
    print("NO")
0