結果

問題 No.1465 Archaea
ユーザー brthyyjpbrthyyjp
提出日時 2021-04-02 21:57:53
言語 PyPy3
(7.3.13)
結果
AC  
実行時間 220 ms / 2,000 ms
コード長 450 bytes
コンパイル時間 698 ms
コンパイル使用メモリ 86,720 KB
実行使用メモリ 150,152 KB
最終ジャッジ日時 2023-08-25 16:15:23
合計ジャッジ時間 4,274 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 61 ms
71,188 KB
testcase_01 AC 59 ms
71,272 KB
testcase_02 AC 60 ms
71,428 KB
testcase_03 AC 60 ms
71,132 KB
testcase_04 AC 61 ms
71,180 KB
testcase_05 AC 61 ms
71,268 KB
testcase_06 AC 60 ms
71,184 KB
testcase_07 AC 123 ms
91,376 KB
testcase_08 AC 62 ms
71,228 KB
testcase_09 AC 108 ms
96,884 KB
testcase_10 AC 69 ms
71,320 KB
testcase_11 AC 120 ms
96,072 KB
testcase_12 AC 68 ms
71,560 KB
testcase_13 AC 195 ms
133,348 KB
testcase_14 AC 97 ms
93,624 KB
testcase_15 AC 64 ms
71,412 KB
testcase_16 AC 61 ms
71,516 KB
testcase_17 AC 200 ms
136,900 KB
testcase_18 AC 73 ms
78,512 KB
testcase_19 AC 115 ms
99,088 KB
testcase_20 AC 128 ms
111,712 KB
testcase_21 AC 220 ms
150,060 KB
testcase_22 AC 220 ms
150,152 KB
testcase_23 AC 60 ms
71,088 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
sys.setrecursionlimit(10**9)
input = sys.stdin.buffer.readline

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

INF = 10**18
memo = {}
def dfs(n):
    if n == 1:
        return 0
    if n in memo:
        return memo[n]
    if n <= 0:
        return INF
    if n%2 == 0:
        res = min(1+dfs(n-3), 1+dfs(n//2))
    else:
        res = 1+dfs(n-3)
    memo[n] = res
    return res
x = dfs(n)
#print(x)
if x <= k:
    print('YES')
else:
    print('NO')
0