結果

問題 No.1465 Archaea
ユーザー H20
提出日時 2021-04-02 22:12:02
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 234 ms / 2,000 ms
コード長 363 bytes
コンパイル時間 165 ms
コンパイル使用メモリ 81,792 KB
実行使用メモリ 138,880 KB
最終ジャッジ日時 2024-12-24 01:19:50
合計ジャッジ時間 2,854 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 20
権限があれば一括ダウンロードができます

ソースコード

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