結果

問題 No.1465 Archaea
ユーザー nephrologistnephrologist
提出日時 2021-04-02 22:03:55
言語 PyPy3
(7.3.15)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 480 bytes
コンパイル時間 629 ms
コンパイル使用メモリ 87,088 KB
実行使用メモリ 72,404 KB
最終ジャッジ日時 2023-08-25 16:15:55
合計ジャッジ時間 4,006 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 104 ms
72,272 KB
testcase_01 AC 103 ms
72,256 KB
testcase_02 AC 103 ms
72,340 KB
testcase_03 AC 106 ms
72,244 KB
testcase_04 AC 104 ms
72,240 KB
testcase_05 AC 104 ms
72,336 KB
testcase_06 AC 104 ms
72,124 KB
testcase_07 AC 102 ms
72,256 KB
testcase_08 AC 104 ms
72,360 KB
testcase_09 AC 103 ms
72,240 KB
testcase_10 AC 103 ms
72,292 KB
testcase_11 AC 103 ms
72,212 KB
testcase_12 AC 103 ms
72,296 KB
testcase_13 AC 106 ms
72,260 KB
testcase_14 AC 105 ms
72,124 KB
testcase_15 AC 103 ms
72,360 KB
testcase_16 AC 104 ms
72,404 KB
testcase_17 AC 105 ms
72,340 KB
testcase_18 AC 104 ms
72,212 KB
testcase_19 AC 103 ms
72,196 KB
testcase_20 AC 104 ms
72,396 KB
testcase_21 AC 103 ms
72,296 KB
testcase_22 AC 104 ms
72,236 KB
testcase_23 WA -
権限があれば一括ダウンロードができます

ソースコード

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