結果

問題 No.1465 Archaea
ユーザー qibqib
提出日時 2022-10-22 17:58:40
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 135 ms / 2,000 ms
コード長 416 bytes
コンパイル時間 290 ms
コンパイル使用メモリ 86,740 KB
実行使用メモリ 93,740 KB
最終ジャッジ日時 2023-09-14 11:37:30
合計ジャッジ時間 3,909 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 89 ms
71,308 KB
testcase_01 AC 89 ms
71,456 KB
testcase_02 AC 90 ms
71,572 KB
testcase_03 AC 92 ms
71,284 KB
testcase_04 AC 89 ms
71,468 KB
testcase_05 AC 88 ms
71,140 KB
testcase_06 AC 89 ms
71,140 KB
testcase_07 AC 109 ms
80,044 KB
testcase_08 AC 89 ms
71,304 KB
testcase_09 AC 109 ms
79,724 KB
testcase_10 AC 92 ms
71,280 KB
testcase_11 AC 109 ms
80,828 KB
testcase_12 AC 99 ms
77,392 KB
testcase_13 AC 128 ms
88,616 KB
testcase_14 AC 108 ms
79,240 KB
testcase_15 AC 93 ms
71,444 KB
testcase_16 AC 99 ms
77,436 KB
testcase_17 AC 126 ms
88,776 KB
testcase_18 AC 103 ms
77,564 KB
testcase_19 AC 114 ms
81,756 KB
testcase_20 AC 115 ms
81,904 KB
testcase_21 AC 135 ms
93,740 KB
testcase_22 AC 132 ms
92,036 KB
testcase_23 AC 92 ms
71,616 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import deque

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

dp = {}
dq = deque()
dq.append(n)
dp[n] = 0
while len(dq) > 0:
  cur = dq.pop()

  nxts = []
  if cur - 3 >= 1:
    nxts.append(cur - 3)
  if cur % 2 == 0:
    nxts.append(cur // 2)

  for nxt in nxts:
    if dp.get(nxt, None) is None:
      dp[nxt] = dp[cur] + 1
      dq.appendleft(nxt)

if dp.get(1, 1 << 60) <= k:
  print("YES")
else:
	print("NO")
0