結果

問題 No.1465 Archaea
ユーザー 👑 H20H20
提出日時 2021-04-02 22:12:02
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 262 ms / 2,000 ms
コード長 363 bytes
コンパイル時間 698 ms
コンパイル使用メモリ 86,808 KB
実行使用メモリ 147,928 KB
最終ジャッジ日時 2023-08-25 16:17:02
合計ジャッジ時間 4,428 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 92 ms
71,256 KB
testcase_01 AC 90 ms
71,668 KB
testcase_02 AC 144 ms
78,500 KB
testcase_03 AC 92 ms
71,480 KB
testcase_04 AC 92 ms
71,540 KB
testcase_05 AC 90 ms
71,256 KB
testcase_06 AC 91 ms
71,504 KB
testcase_07 AC 105 ms
77,184 KB
testcase_08 AC 92 ms
71,468 KB
testcase_09 AC 133 ms
78,828 KB
testcase_10 AC 90 ms
71,584 KB
testcase_11 AC 111 ms
77,320 KB
testcase_12 AC 92 ms
71,928 KB
testcase_13 AC 215 ms
126,596 KB
testcase_14 AC 171 ms
79,512 KB
testcase_15 AC 92 ms
71,428 KB
testcase_16 AC 91 ms
71,688 KB
testcase_17 AC 106 ms
77,068 KB
testcase_18 AC 89 ms
71,704 KB
testcase_19 AC 90 ms
71,544 KB
testcase_20 AC 102 ms
77,024 KB
testcase_21 AC 262 ms
147,852 KB
testcase_22 AC 261 ms
147,928 KB
testcase_23 AC 93 ms
71,708 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
from collections import defaultdict
sys.setrecursionlimit(1000000)
def bfs(n,k):
    if n==1 and k>=0:
        print('YES')
        exit()
    if n<=0 or k<=0:
        return
    if d[n]>k:
        return
    d[n]=k
    bfs(n-3,k-1)
    if n%2==0:
        bfs(n//2,k-1)



N,K = map(int,input().split())
d = defaultdict(lambda: 0)

bfs(N,K)
print('NO')
0