結果

問題 No.1465 Archaea
ユーザー nephrologist
提出日時 2021-04-02 21:59:47
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 478 bytes
コンパイル時間 255 ms
コンパイル使用メモリ 82,048 KB
実行使用メモリ 55,168 KB
最終ジャッジ日時 2024-12-23 19:19:42
合計ジャッジ時間 2,328 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3 WA * 1
other AC * 18 WA * 2
権限があれば一括ダウンロードができます

ソースコード

diff #

from functools import lru_cache

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


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

    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