結果

問題 No.1465 Archaea
ユーザー qibqib
提出日時 2022-10-22 17:58:15
言語 PyPy3
(7.3.15)
結果
RE  
実行時間 -
コード長 403 bytes
コンパイル時間 298 ms
コンパイル使用メモリ 86,560 KB
実行使用メモリ 93,672 KB
最終ジャッジ日時 2023-09-14 11:37:26
合計ジャッジ時間 5,045 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 88 ms
71,304 KB
testcase_01 RE -
testcase_02 RE -
testcase_03 AC 90 ms
71,400 KB
testcase_04 AC 94 ms
71,592 KB
testcase_05 AC 90 ms
71,528 KB
testcase_06 RE -
testcase_07 AC 110 ms
79,940 KB
testcase_08 AC 91 ms
71,472 KB
testcase_09 RE -
testcase_10 RE -
testcase_11 AC 115 ms
80,748 KB
testcase_12 AC 95 ms
77,020 KB
testcase_13 AC 125 ms
88,692 KB
testcase_14 RE -
testcase_15 AC 96 ms
71,596 KB
testcase_16 AC 100 ms
77,332 KB
testcase_17 AC 124 ms
88,652 KB
testcase_18 RE -
testcase_19 AC 111 ms
82,184 KB
testcase_20 RE -
testcase_21 AC 139 ms
93,672 KB
testcase_22 AC 129 ms
91,812 KB
testcase_23 AC 89 ms
71,628 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[1] <= k:
  print("YES")
else:
	print("NO")
0