結果

問題 No.1465 Archaea
コンテスト
ユーザー marroncastle
提出日時 2021-04-02 22:42:28
言語 PyPy3
(7.3.17)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
AC  
実行時間 73 ms / 2,000 ms
コード長 426 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 380 ms
コンパイル使用メモリ 85,288 KB
実行使用メモリ 73,984 KB
最終ジャッジ日時 2026-05-29 21:54:41
合計ジャッジ時間 3,597 ms
ジャッジサーバーID
(参考情報)
judge4_1 / judge2_1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 20
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

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