結果

問題 No.1465 Archaea
ユーザー marroncastlemarroncastle
提出日時 2021-04-02 22:42:28
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 72 ms / 2,000 ms
コード長 426 bytes
コンパイル時間 448 ms
コンパイル使用メモリ 82,768 KB
実行使用メモリ 75,380 KB
最終ジャッジ日時 2024-12-24 01:22:49
合計ジャッジ時間 2,391 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 20
権限があれば一括ダウンロードができます

ソースコード

diff #

N, K = map(int, input().split())
from collections import deque
min_cost = [K+1]*(N+1)
min_cost[1] = 0
que = deque([1])
while len(que):
  a = que.popleft()
  if min_cost[a]<K:
    if a*2<=N and min_cost[a*2] > min_cost[a]+1:
      min_cost[a*2] = min_cost[a]+1
      que.append(a*2)
    if a+3<=N and min_cost[a+3] > min_cost[a]+1:
      min_cost[a+3] = min_cost[a]+1
      que.append(a+3)
print('YNEOS'[int(min_cost[N]>K)::2])
0