結果

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

ソースコード

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 - 3 > 0 and b > 1:
        res |= calc(a - 3, b - 1)
    return res


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