結果

問題 No.1465 Archaea
ユーザー nephrologistnephrologist
提出日時 2021-04-02 21:59:20
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 448 bytes
コンパイル時間 324 ms
コンパイル使用メモリ 87,224 KB
実行使用メモリ 72,640 KB
最終ジャッジ日時 2023-08-25 12:11:15
合計ジャッジ時間 3,955 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 101 ms
72,444 KB
testcase_01 AC 97 ms
72,568 KB
testcase_02 AC 103 ms
72,632 KB
testcase_03 WA -
testcase_04 AC 97 ms
72,560 KB
testcase_05 WA -
testcase_06 AC 94 ms
72,492 KB
testcase_07 AC 98 ms
72,532 KB
testcase_08 AC 103 ms
72,496 KB
testcase_09 AC 103 ms
72,452 KB
testcase_10 AC 101 ms
72,468 KB
testcase_11 AC 97 ms
72,552 KB
testcase_12 AC 98 ms
72,492 KB
testcase_13 AC 99 ms
72,440 KB
testcase_14 AC 97 ms
72,564 KB
testcase_15 AC 98 ms
72,300 KB
testcase_16 AC 98 ms
72,520 KB
testcase_17 AC 97 ms
72,308 KB
testcase_18 AC 96 ms
72,288 KB
testcase_19 AC 95 ms
72,512 KB
testcase_20 AC 98 ms
72,424 KB
testcase_21 AC 93 ms
72,532 KB
testcase_22 AC 96 ms
72,360 KB
testcase_23 WA -
権限があれば一括ダウンロードができます

ソースコード

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:
            res |= calc((a - 3) // 2, b - 2)

    return res


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